Переглянути джерело

위시리스트 50개 선입선출

eskim 5 роки тому
батько
коміт
d61bab82c2

+ 9 - 0
src/main/java/com/style24/front/biz/dao/TsfCustomerDao.java

@@ -95,4 +95,13 @@ public interface TsfCustomerDao {
 	 * @since 2021. 03. 08
 	 */
 	void deleteWishList(WishList wishList);
+	
+	/**
+	 * 위시리스트 삭제 상품 조회
+	 *
+	 * @param custNo
+	 * @author eskim
+	 * @since 2021. 03. 11
+	 */
+	String  getDeleteGoodsWish(int custNo);
 }

+ 10 - 0
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -634,6 +634,16 @@ public class TsfCustomerService {
 			wishInfo.setRegNo(TsfSession.getInfo().getCustNo());
 			customerDao.createWishList(wishInfo);
 		}
+		
+		// 위시상품목록 50개만 남게 처리
+		String goodsCd = customerDao.getDeleteGoodsWish(TsfSession.getInfo().getCustNo());
+		WishList delWishInfo = new WishList();
+		delWishInfo.setCustNo(TsfSession.getInfo().getCustNo());
+		if (!StringUtils.isBlank(goodsCd)) {
+			delWishInfo.setArrGoodsCd(goodsCd.split("\\,"));
+			customerDao.deleteWishList(delWishInfo);
+		}
+		
 	}
 
 	/**

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

@@ -356,7 +356,7 @@ public class TsfGoodsController extends TsfBaseController {
 	 * @param counsel - 상담정보
 	 * @return
 	 * @author gagamel
-	 * @since 2020. 12. 28
+	 * @since 2021. 3. 5
 	 */
 	@PostMapping("/qna/list")
 	@ResponseBody

+ 4 - 0
src/main/java/com/style24/persistence/domain/WishList.java

@@ -1,5 +1,6 @@
 package com.style24.persistence.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.style24.persistence.TscBaseDomain;
 
 import lombok.Data;
@@ -20,5 +21,8 @@ public class WishList extends TscBaseDomain {
 	private String ithrCd;
 	private String contentsLoc;
 	private Integer planDtlSq;
+	
+	@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+	private String[] arrGoodsCd;
 
 }

+ 24 - 2
src/main/java/com/style24/persistence/mybatis/shop/TsfCustomer.xml

@@ -474,8 +474,30 @@
 		/* TsfCustomer.deleteWishInfo */
 		DELETE FROM TB_WISHLIST
 		WHERE  CUST_NO = #{custNo}
-		<if test="goodsCd != null and goodsCd != ''">
+		<choose>
+		<when test="arrGoodsCd != null and arrGoodsCd.length>0">
+		AND UPPER(GOODS_CD) IN
+		    <foreach collection="arrGoodsCd" item="item" index="index"  open="(" close=")" separator=",">
+		UPPER(#{item})
+		    </foreach>
+		</when>	
+		<otherwise>
 		AND    GOODS_CD = #{goodsCd}
-		</if>
+		</otherwise>
+		</choose>
 	</delete>
+	
+	<!-- 위시리스트 삭제 상품 조회 -->
+	<select id="getDeleteGoodsWish" parameterType="int" resultType="String">
+		/* TsfCustomer.getDeleteGoodsWish */
+		SELECT GROUP_CONCAT(GOODS_CD) AS GOODS_CD
+		FROM ( 
+		      SELECT GOODS_CD , REG_DT
+		           , RANK() OVER(ORDER BY REG_DT DESC) AS RNUM
+		      FROM TB_WISHLIST
+		      WHERE CUST_NO = #{custNo}
+		     ) Z
+		WHERE RNUM > 50
+	</select>
+
 </mapper>