bin2107 4 лет назад
Родитель
Сommit
a78c75a503

+ 34 - 0
src/main/java/com/style24/front/biz/service/TsfDisplayService.java

@@ -876,4 +876,38 @@ public class TsfDisplayService {
 		return "http:" + GagaFileUtil.getConcatenationPath(env.getProperty("upload.image.view"), "splashimg", splashImg);
 	}
 
+	/**
+	 * 몰메인 신상풍 목록
+	 * @param
+	 * @return
+	 * @author bin2107
+	 * @date 2021. 7. 13
+	 */
+	public Collection<Contents> getMainNewGoodsList(Contents contents) {
+		Collection<Contents> contentsList = displayDao.getBestItemCategoryList(contents);
+		Cate4Srch tempCate = new Cate4Srch();
+
+		for (Contents data : contentsList) {
+			tempCate.setContentsLoc(data.getContentsLoc());
+			tempCate.setMaxRow(20);
+			tempCate.setCustNo(TsfSession.isLogin() ? TsfSession.getInfo().getCustNo() : 0);
+			tempCate.setSiteCd(data.getSiteCd());
+			tempCate.setCateGb(data.getCateGb());
+			data.setGoodsList(goodsDao.getContentsCategoryNewGoodsList(tempCate));
+		}
+
+		return contentsList;
+	}
+
+	/**
+	 * 몰메인 신상품 목록
+	 * @param
+	 * @return
+	 * @author bin2107
+	 * @date 2021. 7. 13
+	 */
+	public Collection<Goods> getContentsCategoryNewGoodsList(Cate4Srch cate4Srch){
+		return goodsDao.getContentsCategoryNewGoodsList(cate4Srch);
+	}
+
 }

+ 24 - 6
src/main/java/com/style24/front/biz/web/TsfDisplayController.java

@@ -162,6 +162,7 @@ public class TsfDisplayController extends TsfBaseController {
 			String contentsLoc = mainLayout.getContentsLoc();
 			Contents contents = new Contents();
 			log.info("mallMain contentsLoc:::{}", contentsLoc);
+			contents.setContentsCnt(mainLayout.getContentsCnt());
 			contents.setContentsLoc(contentsLoc);
 			contents.setPreview(paramMap.get("preview"));
 			contents.setViewDt(paramMap.get("viewDt"));
@@ -221,7 +222,11 @@ public class TsfDisplayController extends TsfBaseController {
 			}
 
 			if (contentsLoc.equals("SMM003") || contentsLoc.equals("SBM007")) {
-				mainLayout.setNewItemList(displayService.getContentsForGoods(contents));
+				if(Integer.parseInt(mainLayout.getContentsCnt()) > 0){
+					mainLayout.setNewItemList(displayService.getContentsForGoods(contents));
+				}else{
+					mainLayout.setNewItemList(displayService.getMainNewGoodsList(contents));
+				}
 			}
 
 			mainLayoutList.add(mainLayout);
@@ -471,11 +476,24 @@ public class TsfDisplayController extends TsfBaseController {
 				contents.setMaxRow(1);
 				Collection<Contents> conList = displayService.getContentsList(contents);
 				mav.addObject("newGoodsList", null);
-
-				for (Contents contentsData : conList) {
-					cate.setContentsLoc("SCM002");
-					cate.setMaxRow(20);
-					mav.addObject("newGoodsList", goodsService.getContentsCategoryGoodsList(cate));
+				if(Integer.parseInt(cateMain.getContentsCnt()) > 0){
+					for (Contents contentsData : conList) {
+						cate.setContentsLoc("SCM002");
+						cate.setMaxRow(20);
+						mav.addObject("newGoodsList", goodsService.getContentsCategoryGoodsList(cate));
+					}
+				}else{
+					Collection<Contents> contentsList = displayService.getBestItemCategoryList(contents);
+					Cate4Srch tempCate = new Cate4Srch();
+					for (Contents data : contentsList) {
+						tempCate.setContentsLoc(data.getContentsLoc());
+						tempCate.setMaxRow(20);
+						tempCate.setCustNo(TsfSession.isLogin() ? TsfSession.getInfo().getCustNo() : 0);
+						tempCate.setSiteCd(data.getSiteCd());
+						tempCate.setCateGb(data.getCateGb());
+						tempCate.setCate1No(data.getCateNo());
+					}
+					mav.addObject("newGoodsList", displayService.getContentsCategoryNewGoodsList(tempCate));
 				}
 			} else if ("SCM003".equals(cateMain.getContentsLoc())) {
 				// 베스트품

+ 2 - 0
src/main/java/com/style24/persistence/domain/Contents.java

@@ -84,6 +84,8 @@ public class Contents extends TscBaseDomain {
 	private Collection<Goods> goodsList;	// 카테고리목록
 	private Collection<Contents> bannerList;	// 카테고리목록
 
+	private String contentsCnt;     // 브랜드메인에서 사용
+
 	private TscPageRequest pageable;				// 페이징
 	private int pageNo = 1;
 	private int pageSize = 50;

+ 3 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfDisplay.xml

@@ -1136,6 +1136,9 @@
 		WHERE 1=1
 		AND CATE_TYPE = 'G031_20'
 		AND	CONTENTS_LOC = #{contentsLoc}
+		<if test="cateNo != null and cateNo != ''">
+		AND CATE1_NO = #{cateNo}
+		</if>
 	</select>
 
 	<!-- 브랜드 전체 이미지 리스트 조회 -->