Sfoglia il codice sorgente

상품목록 품목 복수조회처리

eskim 4 anni fa
parent
commit
7a24f6b4e3

+ 1 - 0
src/main/java/com/style24/persistence/domain/GoodsSearch.java

@@ -81,6 +81,7 @@ public class GoodsSearch extends TscBaseDomain {
 	private String useYn;
 	private String noticeTitle;
 	private String roleCd;
+	private String itemkindList;
 
 	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
 	private String[] siteCd;

+ 1 - 0
src/main/java/com/style24/scm/biz/service/TssGoodsService.java

@@ -4153,6 +4153,7 @@ public class TssGoodsService {
 	 * @since 2021. 06. 17
 	 */
 	public Collection<Itemkind> getItemkindList(Itemkind itemkind) {
+		log.info("itemkind ={}" , itemkind);
 		return goodsDao.getItemkindList(itemkind);
 	}
 

+ 36 - 10
src/main/java/com/style24/scm/biz/web/TssGoodsController.java

@@ -93,6 +93,9 @@ public class TssGoodsController extends TssBaseController {
 
 	@Autowired
 	private TssCommonService commonService;
+	
+	@Autowired
+	private ObjectMapper mapper;
 
 	private static final int EXCEL_ROW_COUNT = 500;
 
@@ -180,6 +183,16 @@ public class TssGoodsController extends TssBaseController {
 			}
 		}
 
+		if (!StringUtils.isBlank(goodsSearch.getItemkindList())) {
+			try {
+				String[] arrItemkind = mapper.readValue(goodsSearch.getItemkindList(), String[].class);
+				goodsSearch.setMultiItemkindCd(arrItemkind);
+			} catch (Exception e) {
+				e.printStackTrace();
+				throw new IllegalStateException("품목 검색중 오류로 인해 조회되지 않았습니다.");
+			}
+		}
+		
 		goodsSearch.setRegNo(TssSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
 		goodsSearch.setPageable(new TscPageRequest(goodsSearch.getPageNo() - 1, goodsSearch.getPageSize()));
 		goodsSearch.getPageable().setTotalCount(goodsService.getGoodsListCount(goodsSearch));
@@ -1857,16 +1870,7 @@ public class TssGoodsController extends TssBaseController {
 	 */
 	@PostMapping("/itemkind/list")
 	@ResponseBody
-	public Collection<Itemkind> getItemkindList(Itemkind itemkind) {
-		
-		// multi row 검색관련 처리
-		if (!StringUtils.isBlank(itemkind.getSearchItemkindCd())) {
-			itemkind.setMultiItemkindCd(itemkind.getSearchItemkindCd().replaceAll("\r", "").trim().split("\n"));
-		}
-		if (!StringUtils.isBlank(itemkind.getSearchItemkindNm())) {
-			itemkind.setMultiItemkindNm(itemkind.getSearchItemkindNm().replaceAll("\r", "").trim().split("\n"));
-		}
-		
+	public Collection<Itemkind> getItemkind(Itemkind itemkind) {
 		return goodsService.getItemkindList(itemkind);
 	}
 	
@@ -1985,4 +1989,26 @@ public class TssGoodsController extends TssBaseController {
 		return mav;
 	}
 	
+	/**
+	 * 품목 목록
+	 *
+	 * @param itemkind
+	 * @return
+	 * @author eskim
+	 * @since 2021. 06. 27
+	 */
+	@PostMapping("/itemkind/base/list")
+	@ResponseBody
+	public Collection<Itemkind> getItemkindList(@RequestBody Itemkind itemkind) {
+		
+		// multi row 검색관련 처리
+		if (!StringUtils.isBlank(itemkind.getSearchItemkindCd())) {
+			itemkind.setMultiItemkindCd(itemkind.getSearchItemkindCd().replaceAll("\r", "").trim().split("\n"));
+		}
+		if (!StringUtils.isBlank(itemkind.getSearchItemkindNm())) {
+			itemkind.setMultiItemkindNm(itemkind.getSearchItemkindNm().replaceAll("\r", "").trim().split("\n"));
+		}
+		
+		return goodsService.getItemkindList(itemkind);
+	}
 }

+ 33 - 7
src/main/webapp/WEB-INF/views/goods/GoodsListForm.html

@@ -81,13 +81,10 @@
 					<tr>
 						<th>품목</th>
 						<td>
-							<div class="multiCheckBox"  style="width:300px">
-								<button type="button" class="sltBtn" data-name="[전체]">[전체]</button>
-								<ul style="overflow:auto; height:170px;" id="grpItemkind">
-									<li><label class="chkBox" onclick="uifnAllCheck(this,'grpItemkind')"><input type="checkbox" name="전체선택" >전체선택</label></li>
-									<li th:if="${itemkindList}" th:each="oneData, status : ${itemkindList}"><label class="chkBox" data-group="grpItemkind"><input type="checkbox" name="multiItemkindCd" th:id="${'itemkindCd' + oneData.cd}" th:value="${oneData.cd}" ><th:block th:text="${'[' + oneData.cd + '] ' + oneData.cdNm}"></th:block></label></li>
-								</ul>
-							</div>
+							<input type="text" class="w100" name="itemkindSearchTxt" id="itemkindSearchTxt" maxlength="20" />
+							<button type="button" class="btn icn" id="btnSearchItemkind"><i class="fa fa-search"></i></button>
+							<span id="itemkindText"></span>
+							<input type="hidden" name="itemkindList"/>
 						</td>
 						<th>상품상태</th>
 						<td>
@@ -502,6 +499,8 @@
 		$("#searchForm input[type=checkbox]").parent("label").removeClass("checked");
 		$("#searchForm input[type=radio][checked]").parent("label").addClass("checked");
 		$("#multiBrand").empty();
+		$('#searchForm input[name=itemkindList]').val('');
+		$('#searchForm').find('#itemkindText').html('');
 		
 		$(document).find('#searchForm').find(".multiCheckBox").each(function(i, e){
 			let btnNm = $(this).find(".sltBtn").attr("data-name");
@@ -1033,6 +1032,33 @@
 		cfnOpenGoodsDealPopup();
 	});
 
+	// 품목 조회 선택시
+	$('#btnSearchItemkind').on('click', function() {
+		cfnOpenItemkindListPopup('fnSetItemkindInfo', 'M');
+	});
+	
+	// 품목 조회 팝업에서 호출
+	var fnSetItemkindInfo = function(result) {
+		var arrItemkind = [];
+		var itemkindText = "";
+		var sIndex = 0;
+		$('#searchForm').find('#itemkindText').html('');
+		$('#searchForm input[name=itemkindSearchTxt]').val('');
+		result.forEach(function(itemkind){
+			sIndex++; 
+			arrItemkind.push(itemkind.itemkindCd);
+		});
+
+		// 조회값이 하나일 경우 화면에 코드 노출 그외는 갯수 처리 
+		if (sIndex == 1) {
+			$('#searchForm input[name=itemkindSearchTxt]').val(arrItemkind[0]);
+		}else{
+			itemkindText = sIndex + " 개";
+			$('#searchForm').find('#itemkindText').html(itemkindText);	
+		}
+		var jsonData = JSON.stringify(arrItemkind);
+		$("#searchForm input[name=itemkindList]").val(jsonData);
+	}
 	
 	$(document).ready(function() {
 

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

@@ -24,7 +24,7 @@
 		<!-- //TITLE -->
 		<!-- 검색 조건 -->
 		<div class="panelContent">
-			<form id="searchItemkindListForm" name="searchItemkindListForm" action="#" th:action="@{'/goods/itemkind/list'}" onsubmit="$('#btnSearchItemkindList').trigger('click'); return false;">
+			<form id="searchItemkindListForm" name="searchItemkindListForm" action="#" th:action="@{'/goods/itemkind/base/list'}" onsubmit="$('#btnSearchItemkindList').trigger('click'); return false;">
 				<table class="frmStyle" aria-describedby="검색조건">
 					<colgroup>
 						<col style="width:15%;"/>