eskim 5 лет назад
Родитель
Сommit
1a7ddff4c9

+ 17 - 3
src/main/java/com/style24/front/biz/web/TsfGoodsController.java

@@ -688,10 +688,26 @@ public class TsfGoodsController extends TsfBaseController {
 	@ResponseBody
 	public GagaMap getGoodsReviewList(@RequestBody Review review) {
 
-		log.info(" getGoodsReviewList =>{}", review);
+		//log.info(" getGoodsReviewList =>{}", review);
 
 		GagaMap result = new GagaMap();
 
+		review.setReviewHeightSt(0);
+		review.setReviewHeightEd(0);
+		if (StringUtils.isNotBlank(review.getReviewHeight())) {
+			String[] arrHeight = review.getReviewHeight().split("\\-");
+			review.setReviewHeightSt(Integer.parseInt(arrHeight[0]));
+			review.setReviewHeightEd(Integer.parseInt(arrHeight[1]));
+		}
+		
+		review.setReviewWeightSt(0);
+		review.setReviewWeightEd(0);
+		if (StringUtils.isNotBlank(review.getReviewWeight())) {
+			String[] arrWeight = review.getReviewWeight().split("\\-");
+			review.setReviewWeightSt(Integer.parseInt(arrWeight[0]));
+			review.setReviewWeightEd(Integer.parseInt(arrWeight[1]));
+		}
+		
 		TscPageRequest pageable = new TscPageRequest((review.getPageNo() > 0 ? review.getPageNo() - 1 : 0), review.getPageSize(), review.getPageUnit());
 		pageable.setTotalCount(reviewService.getReviewTotalCount(review));
 		review.setPageable(pageable);
@@ -701,9 +717,7 @@ public class TsfGoodsController extends TsfBaseController {
 		}
 		
 		result.set("paging", review);
-		log.info("-------------------------------------------------------------");
 		result.set("dataList", reviewService.getReviewList(review));
-		log.info("-------------------------------------------------------------");
 
 		return result;
 	}

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

@@ -63,6 +63,15 @@ public class Review extends TscBaseDomain {
 	private String goodsType;		// 상품유형
 	private int rownum;
 	
+	private String reviewScore;		// 상품평 검색조건 평점
+	private String reviewOption;	// 상품평 검색조건 옵션
+	private String reviewHeight;	// 상품평 검색조건 키	0-150
+	private int reviewHeightSt;	// 상품평 검색조건 구간시작	0
+	private int reviewHeightEd;	// 상품평 검색조건 구간종료	150
+	private String reviewWeight;	// 상품평 검색조건 몸무게	0-50
+	private int reviewWeightSt;	// 상품평 검색조건 몸무게 구간시작	0
+	private int reviewWeightEd;	// 상품평 검색조건 몸무게 구간종료	50
+	
 	// Masking
 	public String getMaskingCustId() {
 		return (this.custId != null) ?  MaskingUtils.id(this.custId) : this.custId;
@@ -79,4 +88,5 @@ public class Review extends TscBaseDomain {
 	private int pageNo = 1;
 	private int pageSize = 10;
 	private int pageUnit = 10;
+	
 }

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

@@ -38,6 +38,29 @@
 		<if test='photoYn != null and photoYn == "Y"'>
 		AND EXISTS (SELECT 1 FROM TB_REVIEW_ATTACH WHERE DEL_YN = 'N' AND REVIEW_SQ = R.REVIEW_SQ)
 		</if>
+		<if test="reviewScore != null and reviewScore != ''">
+		AND R.SCORE = #{reviewScore}
+		</if>
+		<if test="reviewOption != null and reviewOption != ''">
+		AND EXISTS (SELECT 1
+		            FROM TB_ORDER_DETAIL_ITEM ODI 
+		            WHERE ODI.ORD_NO = R.ORD_NO 
+		            AND ODI.ORD_DTL_NO  = R.ORD_DTL_NO
+		            AND ODI.OPT_CD2 = #{reviewOption}
+		           )
+		</if>
+		<if test="reviewHeight != null and reviewHeight != ''">
+		 <![CDATA[
+		AND R.HEIGHT >= #{reviewHeightSt}
+		AND R.HEIGHT < #{reviewHeightEd}
+		]]>
+		</if>
+		<if test="reviewWeight != null and reviewWeight != ''">
+		<![CDATA[
+		AND R.WEIGHT >= #{reviewWeightSt}
+		AND R.WEIGHT < #{reviewWeightEd}
+		]]>
+		</if>
 		AND R.DEL_YN = 'N'
 	</select>
 		
@@ -96,7 +119,8 @@
 		FROM TB_REVIEW R 
 		INNER JOIN TB_GOODS G ON R.GOODS_CD = G.GOODS_CD
 		INNER JOIN TB_ORDER_DETAIL OD ON R.ORD_NO = OD.ORD_NO 
-		                               AND R.ORD_DTL_NO  = OD.ORD_DTL_NO 
+		                              AND R.ORD_DTL_NO  = OD.ORD_DTL_NO 
+		                              AND R.GOODS_CD = OD.GOODS_CD
 		INNER JOIN TB_CUSTOMER C ON R.REG_NO  = C.CUST_NO
 		AND R.GOODS_CD = #{goodsCd}
 		<if test="reviewSq != null and reviewSq != ''" >
@@ -109,6 +133,29 @@
 		AND EXISTS (SELECT 1 FROM TB_REVIEW_ATTACH WHERE DEL_YN = 'N' AND REVIEW_SQ = R.REVIEW_SQ)
 		</if>
 		AND R.DEL_YN = 'N'
+		<if test="reviewScore != null and reviewScore != ''">
+		AND R.SCORE = #{reviewScore}
+		</if>
+		<if test="reviewOption != null and reviewOption != ''">
+		AND EXISTS (SELECT 1
+		            FROM TB_ORDER_DETAIL_ITEM ODI 
+		            WHERE ODI.ORD_NO = R.ORD_NO 
+		            AND ODI.ORD_DTL_NO  = R.ORD_DTL_NO
+		            AND ODI.OPT_CD2 = #{reviewOption}
+		           )
+		</if>
+		<if test="reviewHeight != null and reviewHeight != ''">
+		 <![CDATA[
+		AND R.HEIGHT >= #{reviewHeightSt}
+		AND R.HEIGHT < #{reviewHeightEd}
+		]]>
+		</if>
+		<if test="reviewWeight != null and reviewWeight != ''">
+		<![CDATA[
+		AND R.WEIGHT >= #{reviewWeightSt}
+		AND R.WEIGHT < #{reviewWeightEd}
+		]]>
+		</if>
 		)Z
 		<if test="rownum != null and rownum > 0 ">
 		WHERE RNUM = 1

+ 66 - 23
src/main/webapp/WEB-INF/views/web/goods/GoodsReviewFormWeb.html

@@ -379,63 +379,68 @@
 			<input type="hidden" name="pageSize" value ="1"/>
 			<input type="hidden" name="goodsCd" th:value ="${goodsInfo.goodsCd}"/>
 			<input type="hidden" name="goodsType" th:value ="${goodsInfo.goodsType}"/>
+			<input type="hidden" name="reviewScore" />
+			<input type="hidden" name="reviewOption" />
+			<input type="hidden" name="reviewHeight" />
+			<input type="hidden" name="reviewWeight" />
+			
 				<h6>전체리뷰<span>(<span id="reviewCount" th:text="${(reviewCount <= 9999) ? #numbers.formatInteger(reviewCount, 0,'COMMA') : '9,999+'}">9,999+</span>)</span></h6>
 				<div class="selection">
 					<div class="form_field">
 						<div class="select_custom sort_opt1">
 							<div class="combo">
-								<div class="select">평점 전체</div>
+								<div class="select">평점 전체<input type="hidden" name="selScore" value=""/></div>
 								<ul class="list" onclick="jfReviewSearch();" >
 									<!-- 선택처리 class="selected" -->
-									<li class="selected" >평점 전체<input type="hidden" name="reviewScore" value=""/></li> 
-									<li>5점&nbsp;&starf;&starf;&starf;&starf;&starf;<input type="hidden" name="reviewScore" value="5"/></li>
-									<li>4점&nbsp;&starf;&starf;&starf;&starf;<input type="hidden" name="reviewScore" value="4" scoreId="4"/></li>
-									<li>3점&nbsp;&starf;&starf;&starf;<input type="hidden" name="reviewScore" value="3"/></li>
-									<li>2점&nbsp;&starf;&starf;<input type="hidden" name="reviewScore" value="2"/></li>
-									<li>1점&nbsp;&starf;<input type="hidden" name="reviewScore" value="1"/></li>
+									<li class="selected" >평점 전체<input type="hidden" name="selScore" value=""/></li> 
+									<li>5점&nbsp;&starf;&starf;&starf;&starf;&starf;<input type="hidden" name="selScore" value="5"/></li>
+									<li>4점&nbsp;&starf;&starf;&starf;&starf;<input type="hidden" name="selScore" value="4" scoreId="4"/></li>
+									<li>3점&nbsp;&starf;&starf;&starf;<input type="hidden" name="selScore" value="3"/></li>
+									<li>2점&nbsp;&starf;&starf;<input type="hidden" name="selScore" value="2"/></li>
+									<li>1점&nbsp;&starf;<input type="hidden" name="selScore" value="1"/></li>
 								</ul>
 							</div>
 						</div>
 						<div class="select_custom sort_opt2" th:if="${reviewOptionList != null and !reviewOptionList.empty}">
 							<div class="combo">
 								<th:block th:if="${(goodsInfo.selfGoodsYn == 'Y')}">
-								<div class="select">사이즈 전체<input type="hidden" name="reviewOption" value=""/></div>
+								<div class="select">사이즈 전체<input type="hidden" name="selOption" value=""/></div>
 								</th:block>
 								<th:block th:unless="${(goodsInfo.selfGoodsYn == 'Y')}">
-								<div class="select">옵션 전체<input type="hidden" name="reviewOption" value=""/></div>
+								<div class="select">옵션 전체<input type="hidden" name="selOption" value=""/></div>
 								</th:block>
-								<ul class="list">
+								<ul class="list" onclick="jfReviewSearch();">
 									<!-- 선택처리 class="selected" -->
 									<li class="selected" th:text="${(goodsInfo.selfGoodsYn == 'Y')? '사이즈 전체' :'옵션 전체'}">사이즈 전체</li> 
 									<li th:each="reviewOption, status : ${reviewOptionList}" >
 									<th:block th:text="${reviewOption.optCd2}"></th:block>
-									<input type="hidden" name="reviewOption" th:value="${reviewOption.optCd2}"/>
+									<input type="hidden" name="selOption" th:value="${reviewOption.optCd2}"/>
 									</li>
 								</ul>
 							</div>
 						</div>
 						<div class="select_custom sort_opt3" th:if="${reviewHeightList != null and !reviewHeightList.empty}">
 							<div class="combo">
-								<div class="select">키 전체<input type="hidden" name="reviewHeight" value=""/></div>
-								<ul class="list">
+								<div class="select">키 전체<input type="hidden" name="selHeight" value=""/></div>
+								<ul class="list" onclick="jfReviewSearch();">
 									<!-- 선택처리 class="selected" -->
-									<li class="selected">키 전체<input type="hidden" name="reviewHeight" value=""/></li> 
+									<li class="selected">키 전체<input type="hidden" name="selHeight" value=""/></li> 
 									<li th:each="reviewHeight, status : ${reviewHeightList}" >
 									<th:block th:text="${reviewHeight.cdNm}"></th:block>
-									<input type="hidden" name="reviewHeight" th:value="${reviewHeight.cd}"/>
+									<input type="hidden" name="selHeight" th:value="${reviewHeight.cd}"/>
 									</li>
 								</ul>
 							</div>
 						</div>
 						<div class="select_custom sort_opt4" th:if="${reviewWeightList != null and !reviewWeightList.empty}">
 							<div class="combo">
-								<div class="select">몸무게 전체<input type="hidden" name="reviewWeight" value=""/></div>
-								<ul class="list">
+								<div class="select">몸무게 전체<input type="hidden" name="selWeight" value=""/></div>
+								<ul class="list" onclick="jfReviewSearch();">
 									<!-- 선택처리 class="selected" -->
-									<li class="selected">몸무게 전체<input type="hidden" name="reviewWeight" value=""/></li> 
+									<li class="selected">몸무게 전체<input type="hidden" name="selWeight" value=""/></li> 
 									<li th:each="reviewWeight, status : ${reviewWeightList}" >
 									<th:block th:text="${reviewWeight.cdNm}"></th:block>
-									<input type="hidden" name="reviewWeight" th:value="${reviewWeight.cd}"/>
+									<input type="hidden" name="selWeight" th:value="${reviewWeight.cd}"/>
 									</li>
 									
 								</ul>
@@ -462,7 +467,7 @@
 						</p>
 					</div>
 					<div class="btn_box">
-						<button class="btn btn_default"><span>선택한 조건 초기화</span></button>
+						<button type="button" class="btn btn_default" onclick="jfReviewSearchInit();"><span>선택한 조건 초기화</span></button>
 					</div>
 				</div>
 				<!-- //나열조건결과 없을 때 노출 내용 -->
@@ -492,6 +497,7 @@
 	var fnGetListCallback = function(result) {
 		$('#ulGoodsReviewQna').html('');
 		$('.nodata').hide();
+		$('.ui_row').show();
 		// 목록
 		if (result.dataList != null && result.dataList.length > 0) {
 			
@@ -611,10 +617,47 @@
 		gagaPaging.createPagination(result.paging.pageable);
 	}
 	
-	var jfReviewSearch = function(obj){
-		debugger;
-		$obj = $(obj);
+	// 상품평 검색조건 클릭시
+	var jfReviewSearch = function(){
+		var reviewScore = $('#goodsReviewForm').find('.select_custom.sort_opt1').find('.select input[name=selScore]').val();
+		var reviewOption = $('#goodsReviewForm').find('.select_custom.sort_opt2').find('.select input[name=selOption]').val();
+		var reviewHeight = $('#goodsReviewForm').find('.select_custom.sort_opt3').find('.select input[name=selHeight]').val();
+		var reviewWeight = $('#goodsReviewForm').find('.select_custom.sort_opt4').find('.select input[name=selWeight]').val();
+		
+		var changFlag = false;
+		if ($('#goodsReviewForm input[name=reviewScore]').val() != reviewScore){
+			changFlag = true;
+		}else if ($('#goodsReviewForm input[name=reviewOption]').val() != reviewOption){
+			changFlag = true;
+		}else if ($('#goodsReviewForm input[name=reviewHeight]').val() != reviewHeight){
+			changFlag = true;
+		}else if ($('#goodsReviewForm input[name=reviewWeight]').val() != reviewWeight){
+			changFlag = true;
+		}
 		
+		$('#goodsReviewForm input[name=reviewScore]').val(reviewScore);
+		$('#goodsReviewForm input[name=reviewOption]').val(reviewOption);
+		$('#goodsReviewForm input[name=reviewHeight]').val(reviewHeight);
+		$('#goodsReviewForm input[name=reviewWeight]').val(reviewWeight);
+		
+		if (changFlag) fnGetList();
+		
+	}
+	
+	// 상품평 초기화
+	var jfReviewSearchInit = function(){
+		
+		$('#goodsReviewForm').find('.select_custom.sort_opt1').find('.list li').eq(0).trigger('click')
+		$('#goodsReviewForm').find('.select_custom.sort_opt2').find('.list li').eq(0).trigger('click')
+		$('#goodsReviewForm').find('.select_custom.sort_opt3').find('.list li').eq(0).trigger('click')
+		$('#goodsReviewForm').find('.select_custom.sort_opt4').find('.list li').eq(0).trigger('click')
+		
+		$('#goodsReviewForm input[name=reviewScore]').val('');
+		$('#goodsReviewForm input[name=reviewOption]').val('');
+		$('#goodsReviewForm input[name=reviewHeight]').val('');
+		$('#goodsReviewForm input[name=reviewWeight]').val('');
+		
+		fnGetList();
 	}
 	
 	$(document).ready( function() {