Quellcode durchsuchen

[ST24PRJ-119] [MD개선] 공통 > 브랜드목록 검색 팝업 > 업체조건 추가

jmh vor 4 Jahren
Ursprung
Commit
e19d630301

+ 10 - 0
src/main/java/com/style24/admin/biz/web/TsaBusinessController.java

@@ -348,6 +348,16 @@ public class TsaBusinessController extends TsaBaseController {
 		if (!StringUtils.isBlank(brand.getSearchBrandNm())) {
 			brand.setMultiBrandNm(brand.getSearchBrandNm().replaceAll("\r", "").trim().split("\n"));
 		}
+		
+		if (!StringUtils.isBlank(brand.getSupplyCompList())) {
+			try {
+				String[] arrSupplyComp = mapper.readValue(brand.getSupplyCompList(), String[].class);
+				brand.setMultiSupplyCompCd(arrSupplyComp);
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new IllegalStateException("업체코드 검색중 오류로 인해 조회되지 않았습니다.");
+			}
+		}
 
 		return businessService.getBrandList(brand);
 	}

+ 5 - 1
src/main/java/com/style24/persistence/domain/Brand.java

@@ -56,6 +56,7 @@ public class Brand extends TscBaseDomain {
 	private String multiGb;			// 멀티 셀렉트 구분
 	private String searchBrandCd;
 	private String searchBrandNm;
+	private String supplyCompList;
 
 	/* 브랜드검색 Multi CheckBox 항목*/
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
@@ -64,5 +65,8 @@ public class Brand extends TscBaseDomain {
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] multiBrandNm;
 	/* 브랜드검색 Multi CheckBox 항목*/
-
+	
+	/* 업체 Multi CheckBox 항목*/
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiSupplyCompCd;
 }

+ 9 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsaBusiness.xml

@@ -535,7 +535,8 @@
 		FROM   TB_BRAND A
 		INNER JOIN TB_BRAND_GROUP D ON A.BRAND_GROUP_NO = D.BRAND_GROUP_NO
 		                            AND D.USE_YN = 'Y'
-		<if test='supplyCompCd != null and supplyCompCd != ""'>
+		
+		<if test="(supplyCompCd != null and supplyCompCd != '') or (multiSupplyCompCd != null and multiSupplyCompCd.length > 0)">
 		INNER JOIN TB_BRAND_SUPPLY C ON A.BRAND_CD = C.BRAND_CD
 		INNER JOIN TB_SUPPLY_COMPANY B ON C.SUPPLY_COMP_CD = B.SUPPLY_COMP_CD
 		</if>
@@ -582,6 +583,13 @@
 		  </foreach>
 		 )
 		</if>
+		<if test="multiSupplyCompCd != null and multiSupplyCompCd.length > 0">
+		AND    C.SUPPLY_COMP_CD IN
+		    <foreach collection="multiSupplyCompCd" item="item" index="index"  open="(" close=")" separator=",">
+			#{item}
+		    </foreach>
+		</if>
+		
 		<if test='useYn != null and useYn != ""'>
 		AND    A.USE_YN = #{useYn}
 		</if>

+ 39 - 0
src/main/webapp/WEB-INF/views/business/BrandPopupForm.html

@@ -33,6 +33,15 @@
 						<col/>
 					</colgroup>
 					<tbody>
+						<tr>
+							<th>업체</th>
+							<td colspan="3">
+								<input type="text" class="w100" name="popSupplyCompSearchTxt" id="popSupplyCompSearchTxt" maxlength="20" />
+								<button type="button" class="btn icn" id="popBtnSearchSupplyComp"><i class="fa fa-search"></i></button>
+								<span id="popSupplyCompText"></span>
+								<input type="hidden" name="supplyCompList"/>
+							</td>
+						</tr>
 						<tr>
 							<th>자사/입점</th>
 							<td colspan="3">
@@ -137,6 +146,36 @@
 			uifnPopupClose('popupBrandList');
 		}
 	});
+			
+	// 업체 조회 선택시
+	$('#popBtnSearchSupplyComp').on('click', function() {
+		cfnOpenCompanyListPopup('fnSetSupplyCompInfoPop', 'M');
+	});
+	
+	// 업체 조회 팝업에서 호출
+	var fnSetSupplyCompInfoPop = function(result) {
+		var arrSupplyComp = [];
+		var supplyCompText = "";
+		var sIndex = 0;
+		var supplyCompNm = "";
+		$('#searchBrandListForm').find('#popSupplyCompText').html('');
+		$('#searchBrandListForm input[name=popSupplyCompSearchTxt]').val('');
+		result.forEach(function(supplyComp){
+			sIndex++; 
+			arrSupplyComp.push(supplyComp.supplyCompCd);
+			supplyCompNm = supplyComp.supplyCompNm;
+		});
+
+		// 조회값이 하나일 경우 화면에 코드 노출 그외는 갯수 처리 
+		if (sIndex == 1) {
+			$('#searchBrandListForm input[name=popSupplyCompSearchTxt]').val(supplyCompNm);
+		}else{
+			supplyCompText = sIndex + " 개";
+			$('#searchBrandListForm').find('#popSupplyCompText').html(supplyCompText);	
+		}
+		var jsonData = JSON.stringify(arrSupplyComp);
+		$("#searchBrandListForm input[name=supplyCompList]").val(jsonData);
+	}
 	
 	$(document).ready(function() {
 		// Create a agGrid