소스 검색

상품상세 다다익선 로직 수정

eskim 5 년 전
부모
커밋
68ec0682e3
2개의 변경된 파일13개의 추가작업 그리고 13개의 파일을 삭제
  1. 4 3
      src/main/java/com/style24/front/biz/service/TsfGoodsService.java
  2. 9 10
      src/main/java/com/style24/persistence/mybatis/shop/TsfGoods.xml

+ 4 - 3
src/main/java/com/style24/front/biz/service/TsfGoodsService.java

@@ -579,20 +579,21 @@ public class TsfGoodsService {
 		if (tmtbSqList == null || tmtbSqList.isEmpty()) {
 			return result;
 		}
-		
+		log.info("[tmtbSqList]={}",tmtbSqList);
+		log.info("[goods]={}",goods);
 		int rCount = 0;	//다다익선 조회수
 		int tCount = goods.getMaxRownum();	//리턴 잔여수
 		if (tCount == 0) tCount = 20;
 		
 		for (Tmtb tmtb: tmtbSqList) {
 			
-			tmtb.setTmtbSq(tmtb.getTmtbSq());
+			goods.setTmtbSq(tmtb.getTmtbSq());
 			Collection<Goods> tmtbGoodsList = goodsDao.getTmtbGoodsList(goods);
 			if (tmtbGoodsList == null || tmtbGoodsList.isEmpty()) {
 				continue;
 			}
 			
-			if (tCount == 0) { //잔여수가 없으면 종료
+			if (tCount <= 0) { //잔여수가 없으면 종료
 				break;
 			}
 			

+ 9 - 10
src/main/java/com/style24/persistence/mybatis/shop/TsfGoods.xml

@@ -881,18 +881,17 @@
 		                                 AND GS.STOCK_QTY > 0
 		    WHERE NOW() BETWEEN A.TMTB_ST_DT AND A.TMTB_ED_DT
 		    AND A.TMTB_STAT ='G232_11'
-		    <if test="arrTmtbSq != null and arrTmtbSq.length > 0">
+		    <choose>
+		    <when test="arrTmtbSq != null and arrTmtbSq.length > 0">
 		    AND A.TMTB_SQ IN
-				<foreach collection="arrTmtbSq" item="item" index="index"  open="(" close=")" separator=",">
-			#{item}
-				</foreach>
-			</if>
+		         <foreach collection="arrTmtbSq" item="item" index="index"  open="(" close=")" separator=",">
+		    #{item}
+		         </foreach>
+		    </when>
+		    <otherwise>
 		    AND A.TMTB_SQ = #{tmtbSq}
-		     <![CDATA[
-		   -- AND A.TMTB_SQ IN (SELECT TMTB_SQ FROM TB_TMTB_APPLY_GOODS WHERE GOODS_CD = #{goodsCd} AND DEL_YN = 'N' AND GOODS_GB IN ( 'G800_10', 'G800_20')) -- 기본과 적용상품
-		   -- AND A.TMTB_SQ NOT IN (SELECT TMTB_SQ FROM TB_TMTB_APPLY_GOODS WHERE GOODS_CD = #{goodsCd} AND DEL_YN = 'N' AND GOODS_GB = 'G800_30') -- 제외상품
-		     ]]>
-		    -- ORDER BY A.TMTB_SQ DESC
+		    </otherwise>
+		    </choose>
 		    ) Z
 		WHERE RNUM <![CDATA[<= ]]>#{maxRownum}
 		)