bin2107 5 лет назад
Родитель
Сommit
af0e096293

+ 18 - 3
src/main/java/com/style24/admin/biz/web/TsaCustomerController.java

@@ -5,6 +5,7 @@ import java.util.Collection;
 import com.gagaframework.web.parameter.GagaMap;
 import com.gagaframework.web.util.GagaStringUtil;
 import com.style24.admin.biz.service.TsaCustomerService;
+import com.style24.admin.support.util.TsitUtil;
 import com.style24.core.biz.service.TscKakaotalkService;
 import com.style24.core.biz.service.TscMailService;
 import com.style24.core.support.env.TscConstants;
@@ -336,10 +337,24 @@ public class TsaCustomerController extends TsaBaseController {
 	@ResponseBody
 	public GagaMap getCustomerActiveList(@RequestBody CustomerSearch customerSearch) {
 		GagaMap result = new GagaMap();
-		// 회원명, 이메일 암호화
-		if ("custNm".equals(customerSearch.getSearchGb()) || "email".equals(customerSearch.getSearchGb())) {
-			customerSearch.setSearchTxt(CryptoUtils.encryptAES(customerSearch.getSearchTxt()));
+		// multi row 검색관련 처리
+		if (!StringUtils.isBlank(customerSearch.getCondition())) {
+			if(customerSearch.getSearch().equals("custNm") || customerSearch.getSearch().equals("email")){
+				String[] multiParams = customerSearch.getCondition().replaceAll("\r", "").split("\n");
+				for (int i = 0; i < multiParams.length; i++) {
+					multiParams[i] = CryptoUtils.encryptAES(multiParams[i]);
+				}
+
+				customerSearch.setConditions(multiParams);
+			}else{
+				customerSearch.setConditions(customerSearch.getCondition().replaceAll("\r", "").split("\n"));
+			}
 		}
+
+		// 회원명, 이메일 암호화
+//		if ("custNm".equals(customerSearch.getSearchGb()) || "email".equals(customerSearch.getSearchGb())) {
+//			customerSearch.setSearchTxt(CryptoUtils.encryptAES(customerSearch.getSearchTxt()));
+//		}
 		if(!"Y".equals(customerSearch.getCpnPubPopYn())){
 			customerSearch.setCpnPubPopYn("N");
 		}

+ 7 - 0
src/main/java/com/style24/persistence/domain/CustomerSearch.java

@@ -1,5 +1,6 @@
 package com.style24.persistence.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.core.support.util.CryptoUtils;
 import com.style24.persistence.TscBaseDomain;
 import com.style24.persistence.TscPageRequest;
@@ -40,6 +41,12 @@ public class CustomerSearch extends TscBaseDomain {
 	// 쿠폰발행팝업
 	private String cpnPubPopYn;		// 쿠폰발행팝업
 
+	private String condition; // 키워드 종류
+	private String search; // 검색어
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] conditionList;
+	private String[] conditions;
+
 	private TscPageRequest pageable;
 	private int pageNo = 1;
 	private int pageSize = 50;

+ 44 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsaCustomer.xml

@@ -75,6 +75,28 @@
 		<if test="custId != null and custId != ''">
 		AND    CUST_ID = #{custId}
 		</if>
+		<if test="condition != null and condition != ''">
+			<choose>
+				<when test="search != null and search == 'custId'">
+					AND
+					<foreach collection="conditions" item="item" index="index" separator="or">
+						UPPER(CUST_ID) LIKE CONCAT('%',UPPER(#{item}),'%')
+					</foreach>
+				</when>
+				<when test="search != null and search == 'custNm'">
+					AND
+					<foreach collection="conditions" item="item" index="index" separator="or">
+						UPPER(CUST_NM) LIKE CONCAT('%',UPPER(#{item}),'%')
+					</foreach>
+				</when>
+				<when test="search != null and search == 'email'">
+					AND
+					<foreach collection="conditions" item="item" index="index" separator="or">
+						UPPER(EMAIL) LIKE CONCAT('%',UPPER(#{item}),'%')
+					</foreach>
+				</when>
+			</choose>
+		</if>
 	</select>
 
 	<!-- 활동회원목록 -->
@@ -187,6 +209,28 @@
 		<if test="custId != null and custId != ''">
 		AND    CUST_ID = #{custId}
 		</if>
+		<if test="condition != null and condition != ''">
+			<choose>
+				<when test="search != null and search == 'custId'">
+					AND
+					<foreach collection="conditions" item="item" index="index" separator="or">
+						UPPER(CUST_ID) LIKE CONCAT('%',UPPER(#{item}),'%')
+					</foreach>
+				</when>
+				<when test="search != null and search == 'custNm'">
+					AND
+					<foreach collection="conditions" item="item" index="index" separator="or">
+						UPPER(CUST_NM) LIKE CONCAT('%',UPPER(#{item}),'%')
+					</foreach>
+				</when>
+				<when test="search != null and search == 'email'">
+					AND
+					<foreach collection="conditions" item="item" index="index" separator="or">
+						UPPER(EMAIL) LIKE CONCAT('%',UPPER(#{item}),'%')
+					</foreach>
+				</when>
+			</choose>
+		</if>
 		<if test='cpnPubPopYn != null and cpnPubPopYn != "Y"'>
 		<include refid="selectForPagingFooter"/>
 		</if>

+ 8 - 13
src/main/webapp/WEB-INF/views/marketing/CouponPubForCustPopupForm.html

@@ -39,9 +39,12 @@
 									<option th:if="${siteCdList}" th:each="oneData , status : ${siteCdList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
 								</select>
 							</td>
-							<th>회원ID</th>
-							<td>
-								<input type="text" class="w200" id="custId" name="custId">
+							<th rowspan="3">키워드</th>
+							<td rowspan="3"><select name="search" id="search">
+								<option value="custId">회원ID</option>
+								<option value="custNm">회원명</option>
+								<option value="email">이메일</option>
+							</select> <textarea class="textareaR3 w70p" name="condition" id="condition"></textarea>
 							</td>
 						</tr>
 						<tr>
@@ -52,6 +55,8 @@
 									<option th:if="${usableCustGbList}" th:each="oneData , status : ${usableCustGbList}" th:value="${oneData.cd}" th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></option>
 								</select>
 							</td>
+						</tr>
+						<tr>
 							<th>회원등급</th>
 							<td>
 								<select name="custGrade" id="custGrade">
@@ -60,16 +65,6 @@
 								</select>
 							</td>
 						</tr>
-						<tr>
-							<th>이메일</th>
-							<td>
-								<input type="text" class="w200"  id="email" name="email">
-							</td>
-							<th>회원명</th>
-							<td>
-								<input type="text" class="w200" id="custNm" name="custNm">
-							</td>
-						</tr>
 					</tbody>
 				</table>
 			</form>