瀏覽代碼

Merge branch 'eskim' into develop

eskim 4 年之前
父節點
當前提交
8eaa4b4492

+ 17 - 0
src/main/java/com/style24/admin/biz/web/TsaGoodsController.java

@@ -1785,6 +1785,23 @@ public class TsaGoodsController extends TsaBaseController {
 	@PostMapping("/video/list")
 	@ResponseBody
 	public Collection<GoodsVideo> getGoodsVideoList(@RequestBody GoodsVideo goodsVideo) {
+		
+		// multi row 검색관련 처리
+		if (!StringUtils.isBlank(goodsVideo.getCondition())) {
+			goodsVideo.setConditionList(goodsVideo.getCondition().replaceAll("\r", "").trim().split("\n"));
+
+		}
+
+		if (!StringUtils.isBlank(goodsVideo.getBrandList())) {
+			try {
+				String[] arrBrandCd = mapper.readValue(goodsVideo.getBrandList(), String[].class);
+				goodsVideo.setMultiBrand(arrBrandCd);
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new IllegalStateException("브랜드코드 검색중 오류로 인해 조회되지 않았습니다.");
+			}
+		}
+		
 		return goodsService.getGoodsVideoList(goodsVideo);
 	}
 

+ 10 - 0
src/main/java/com/style24/persistence/domain/GoodsVideo.java

@@ -1,5 +1,6 @@
 package com.style24.persistence.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 
 import lombok.Data;
@@ -30,5 +31,14 @@ public class GoodsVideo extends TscBaseDomain {
 	private String stDate;
 	private String edDate;
 	
+	private String search; // 키워드 종류
+	private String condition; // 키워드 종류별 값
+	private String brandList;
+	
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] multiBrand;
+
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] conditionList;
 
 }

+ 48 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsaGoods.xml

@@ -2961,6 +2961,53 @@
 		AND A.REG_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
 		]]>
 		</if>
+		<if test='conditionList != null and conditionList.length>0'>
+		    <choose>
+		      <when test='search != null and search == "searchGoodsCd"'>
+		AND (
+		      <foreach collection="conditionList" item="item" index="index" separator="or">
+		       A.GOODS_CD LIKE CONCAT(UPPER(#{item}),'%') 
+		      </foreach>
+		     )
+		      </when>
+		      <when test='search != null and search == "searchGoodsNm"'>
+		AND (
+		      <foreach collection="conditionList" item="item" index="index" separator="or">
+		       UPPER(C.GOODS_NM) LIKE CONCAT(UPPER(#{item}),'%') 
+		      </foreach>
+		     )
+		      </when>
+		       <when test='search != null and search == "searchGoodsNum"'>
+		AND (
+		      <foreach collection="conditionList" item="item" index="index" separator="or">
+		       UPPER(C.GOODS_NUM) LIKE CONCAT(UPPER(#{item}),'%') 
+		      </foreach>
+		     )
+		      </when>
+		      <when test='search != null and search == "searchSupplyGoodsCd"'>
+		AND (
+		      <foreach collection="conditionList" item="item" index="index" separator="or">
+		       UPPER(C.SUPPLY_GOODS_CD) LIKE CONCAT(UPPER(#{item}),'%') 
+		      </foreach>
+		     )
+		      </when>
+		      <when test='search != null and search == "searchExtendGoodsCd"'>
+		AND 1 = 1
+		      </when>
+		      <when test='search != null and search == "searchMasterGoodsCd"'>
+		AND 1 = 1
+		      </when>
+		      <otherwise>
+		AND 1 = 1
+		      </otherwise>
+		    </choose>
+		</if>
+		<if test="multiBrand != null and multiBrand != ''">
+		AND C.BRAND_CD IN
+		    <foreach collection="multiBrand" item="item" index="index"  open="(" close=")" separator=",">
+		#{item}
+		    </foreach>
+		</if>
 		ORDER BY A.VIDEO_SQ DESC
 	</select>
 		
@@ -3637,7 +3684,7 @@
 		    <![CDATA[
 		AND IA.REQ_DT < DATE_FORMAT(DATE_ADD(#{edDate}, INTERVAL 1 DAY), '%Y-%m-%d %H:%i:%S')
 		    ]]>
-			</if>
+		    </if>
 		</if>
 		<if test='dateGbn != null and dateGbn == "alarmDt"'>
 		    <if test="stDate != null and stDate != ''">

+ 4 - 1
src/main/webapp/WEB-INF/views/goods/GoodsItemkindForm.html

@@ -23,7 +23,7 @@
 		<!-- 메뉴 설명 -->
 		<div class="infoBox menu-desc">
 		</div>
-		<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/list'}">
+		<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/list'}" onsubmit="return false;">
 		<input type="hidden" id="searchGb" name="searchGb" />
  		<!-- 패널 영역1 -->
 		<div class="panelStyle" >
@@ -273,6 +273,9 @@
 
 	// 조회
 	$('#btnSearch').on('click', function() {
+		
+		if (event.keyCode === 13) return false;
+		
 		if(gagajf.isNull($("#selCate2").val()) && gagajf.isNull($("#supplyCompCd").val()) && gagajf.isNull($("#condition").val()) 
 			&& gagajf.isNull($("#styleYear").val()) && gagajf.isNull($("#formalGb").val()) && gagajf.isNull($("#mdNo").val())
 			&& gagajf.isNull($("#searchForm input[name=supplyCompList]").val()) && gagajf.isNull($("#searchForm input[name=brandList]").val())

+ 2 - 0
src/main/webapp/WEB-INF/views/goods/GoodsSupplyPriceForm.html

@@ -260,6 +260,8 @@
 		var formId = '#goodsPriceHstForm';
 		var form = document.goodsPriceHstForm;
 
+		if (event.keyCode === 13) return false;
+		
 		if ($("#goodsPriceHstForm input[name=confirmY]").val() == "Y") return true;
 		
 		var searchFlag = false;

+ 2 - 0
src/main/webapp/WEB-INF/views/goods/GoodsTitleReserveForm.html

@@ -253,6 +253,8 @@
 		var formId = '#goodsTnmListForm';
 		var form = document.goodsTnmListForm;
 
+		if (event.keyCode === 13) return false;
+		
 		if($("#goodsTnmListForm input[name=searchGb]").val() == "EXCEL") return true;
 		
 		var searchFlag = false;

+ 60 - 25
src/main/webapp/WEB-INF/views/goods/GoodsVideoForm.html

@@ -32,36 +32,39 @@
 			<div class="panelContent">
 			
 			<form id="searchForm" name="searchForm" action="#" th:action="@{'/goods/video/list'}">
+				
 				<table class="frmStyle">
 					<colgroup>
 						<col style="width:10%;"/>
-						<col style="width:40%;"/>
+						<col style="width:62%;"/>
 						<col style="width:10%;"/>
 						<col/>
 					</colgroup>
 					<tr>
-						<th>키워드</th>
-						<td>
-							<select name="keyWord">
-								<option value="goodsCd">상품코드</option>
-								<option value="goodsNm">상품명</option>
-								<option value="goodsNum">품번</option>
-								<option value="supplyGoodsCd">업체상품코드</option>
-							</select>
-							<input type="text" class="w100" maxlength="20" name="searchTxt" placeholder=""/>
-							<input type="text" class="off" name="goodsCd" id="goodsCd"/>
-							<input type="text" class="off" name="goodsNm" id="goodsNm"/>
-							<input type="text" class="off" name="goodsNum" id="goodsNum"/>
-							<input type="text" class="off" name="supplyGoodsCd" id="supplyGoodsCd"/>
-						</td>
 						<th>브랜드명</th>
 						<td>
-							<input type="text" class="w200" name="brandEnm" placeholder="" maxlength="50"/>
+							<input type="hidden" name="xxxx" value="xxxx"/> <!-- submit 방지 -->
+							<input type="text" class="w100" name="searchTxt" id="searchTxt" maxlength="20" />
+							<button type="button" class="btn icn" id="btnSearchBrand"><i class="fa fa-search"></i></button>
+							<span id="brandText"></span>
+							<input type="hidden" name="brandList"/>
+							
+						</td>
+						<th rowspan="2">키워드</th>
+						<td rowspan="2">
+							<select name="search" id="search">
+								<option value="searchGoodsCd">상품코드</option>
+								<option value="searchGoodsNm">상품명</option>
+								<option value="searchGoodsNum">품번</option>
+								<option value="searchSupplyGoodsCd">업체상품코드</option>
+							</select>
+							<textarea class="textareaR2 w50p" name="condition" id="condition"></textarea>
 						</td>
+						
 					</tr>
 					<tr>
 						<th>등록일</th>
-						<td colspan="3" id="sellTerms">
+						<td id="sellTerms">
 						</td>
 					</tr>
 				</table>
@@ -92,7 +95,7 @@
 		<!-- //리스트 영역 -->
 		<!-- 등록/수정 -->
 		<div class="panelStyle">
-			<form id="detailForm" name="detailForm" action="#" >
+			<form id="detailForm" name="detailForm">
 				<table class="frmStyle">
 					<colgroup>
 						<col style="width:10%;"/>
@@ -266,15 +269,9 @@
 	
 	// 조회
 	$('#btnSearch').on('click', function() {
-		$("#goodsCd").val('');
-		$("#goodsNm").val('');
-		$("#goodsNum").val('');
-		$("#supplyGoodsCd").val('');
-		$("#"+$("#searchForm select[name=keyWord]").val()).val($("#searchForm input[name=searchTxt]").val());
 		
 		if(!fnConditionCheck()) return;
 		
-		
 		// Fetch data
 		gagaAgGrid.fetch($('#searchForm').prop('action'), gridOptions, '#searchForm');
 		$("#btnNew").click();
@@ -282,6 +279,9 @@
 	
 	//검색 조건 확인
 	var fnConditionCheck = function(){
+		
+		if (event.keyCode === 13) return false;
+		
 		var form = document.searchForm;
 
 		var searchFlag = false;
@@ -290,7 +290,7 @@
 		for (i = 0; i < form.elements.length; i++ ) {
 			var el = form.elements[i];
 
-			if ($(el).prop("type") == "text" || ($(el).prop("type") == "select-one" && el.name != "search" && el.name != "pageSize" && el.name != "keyWord")) {
+			if ($(el).prop("type") == "text" || $(el).prop("type") == "textarea" || ($(el).prop("type") == "select-one" && el.name != "search" && el.name != "pageSize")) {
 				if (!(el.value == null || el.value == "")) {
 					cnt++;
 				}
@@ -315,6 +315,8 @@
 	// 검색조건 초기화
 	$('#btnInit').on('click', function() {
 		$("#searchForm")[0].reset();
+		$('#searchForm input[name=brandList]').val('');
+		$('#searchForm').find('#brandText').html('');
 	});
 	
 	// 선택상품 사용안함
@@ -334,6 +336,39 @@
 		}
 	});
 	
+
+	// 브랜드 조회 선택시
+	$('#btnSearchBrand').on('click', function() {
+		/* if (gagajf.isNull($("#searchForm input[name=searchTxt]").val())){
+			mcxDialog.alert('브랜드 검색어를 입력하세요.');
+			return false;
+		} */
+		cfnOpenBrandListPopup('fnSetBrandInfo', 'M');
+	});
+	
+	// 브랜드 조회 팝업에서 호출
+	var fnSetBrandInfo = function(result) {
+		var arrbrandCd = [];
+		var brandText = "";
+		var bIndex = 0;
+		$('#searchForm').find('#brandText').html('');
+		$('#searchForm input[name=searchTxt]').val('');
+		result.forEach(function(brand){
+			bIndex++; 
+			arrbrandCd.push(brand.brandCd);
+		});
+
+		// 조회값이 하나일 경우 화면에 코드 노출 그외는 갯수 처리 
+		if (bIndex == 1) {
+			$('#searchForm input[name=searchTxt]').val(arrbrandCd[0]);
+		}else{
+			brandText = bIndex + " 개";
+			$('#searchForm').find('#brandText').html(brandText);	
+		}
+		var jsonData = JSON.stringify(arrbrandCd);
+		$("#searchForm input[name=brandList]").val(jsonData);
+	}
+	
 	// 동영상 저장
 	$("#btnSave").on('click', function() {