Explorar el Código

브랜드메인 추천상품 추가

bin2107 hace 5 años
padre
commit
d30a97fab8

+ 12 - 2
src/main/java/com/style24/front/biz/service/TsfGoodsService.java

@@ -743,11 +743,15 @@ public class TsfGoodsService {
 
 		Collection<Goods> goodsList = new ArrayList<>();
 
-		if (cate.getContentsLoc().equals("SCM002") || cate.getContentsLoc().equals("SBM007") || cate.getContentsLoc().equals("SMM003")) { // 신상품인 경우
+		if (cate.getContentsLoc().equals("SCM002") || cate.getContentsLoc().equals("SBM007") || cate.getContentsLoc().equals("SMM003") || cate.getContentsLoc().equals("SBM003")) { // 신상품인 경우
+			int maxRow = 20;
+			if(cate.getContentsLoc().equals("SBM003")){
+				maxRow = 3;
+			}
 			goodsList = goodsDao.getContentsCategoryGoodsList(cate);
 
 			// 조회된 데이터가 없거나 건수가 20개 미만이면 신규상품(=정상상품) 조회
-			if (goodsList == null || goodsList.size() < 20) {
+			if (goodsList == null || goodsList.size() < maxRow) {
 				if (goodsList != null) {
 					// 제외상품 설정
 					StringBuilder sb = new StringBuilder();
@@ -758,6 +762,12 @@ public class TsfGoodsService {
 						cate.setExceptGoodsArr(sb.toString().substring(0, sb.toString().length() - 1).split(","));
 					}
 				}
+				maxRow = maxRow - goodsList.size();
+				cate.setMaxRow(maxRow);
+				if(cate.getContentsLoc().equals("SBM003")){
+					cate.setCate1No(null);
+				}
+
 				goodsList.addAll(goodsDao.getContentsCategoryNewGoodsList(cate));
 			}
 		} else if (cate.getContentsLoc().equals("SCM003") || cate.getContentsLoc().equals("SBM008")) { // 베스트상품인 경우

+ 15 - 0
src/main/java/com/style24/front/biz/web/TsfDisplayController.java

@@ -678,4 +678,19 @@ public class TsfDisplayController extends TsfBaseController {
 		return displayService.getGnbTabBannerlist(contents);
 	}
 
+	/**
+	 * 브랜드 GNB 탭 추천상풍 목록
+	 * @param
+	 * @return
+	 * @throws Exception
+	 * @author bin2107
+	 * @since 2021. 4. 15
+	 */
+	@GetMapping("/brand/gnb/tab/recommend/goods/list")
+	@ResponseBody
+	public Collection<Goods> getBrandGnbTabRecommendGoodsList(Cate4Srch cate4Srch) {
+		Collection<Goods> goodsList = goodsService.getContentsCategoryGoodsList(cate4Srch);
+		return goodsList;
+	}
+
 }

+ 2 - 0
src/main/java/com/style24/persistence/mybatis/shop/TsfGoods.xml

@@ -1230,7 +1230,9 @@
 		            AND    C4.SITE_CD = #{siteCd}
 		            AND    C4.CATE_GB = #{cateGb}
 		            AND    C4.CATE_TYPE = 'G031_10' /*상품카테고리*/
+		            <if test="cate1No != null and cate1No != ''">
 		            AND    C4.CATE1_NO = #{cate1No}
+		            </if>
 		            <if test="exceptGoodsArr != null and exceptGoodsArr.length > 0">
 		            AND	   CG.GOODS_CD NOT IN
 		                <foreach collection="exceptGoodsArr" item="item" index="index"  open="(" close=")" separator=",">

+ 43 - 2
src/main/webapp/WEB-INF/views/web/common/fragments/BrandGnbWeb.html

@@ -19,7 +19,7 @@
 	<div class="common_header br_header" th:style="${'background-color: #' + brandGroupInfo.rgbCd}">
 		<div class="area">
 			<div class="logo">
-				<a href="#none">
+				<a href="javascript:void(0);" th:onclick="cfnGoToBrandMain([[${brandGroupInfo.brandGroupNo}]]);">
 					<h1>
 						<!-- <img th:src="${@environment.getProperty('domain.image') + brandGroupInfo.logoFileNm}" src="/images/pc/thumb/br_tbj_logo.png" alt="TBJ nearby"/> -->
 						<p th:text="${brandGroupInfo.brandGroupNm}"></p>
@@ -38,7 +38,7 @@
 			<!-- nav -->
 			<div class="nav">
 				<ul class="bundle" id="ulGnbTab">
-					<li class="home"><a href="javascript:void(0);" onclick="cfnGoToBrandMain([[${brandGroupInfo.brandGroupNo}]]);">브랜드 홈</a></li>
+					<li class="home"><a href="javascript:void(0);" th:onclick="cfnGoToBrandMain([[${brandGroupInfo.brandGroupNo}]]);">브랜드 홈</a></li>
 					<li class="has_depth"><!-- depth_menu 있을 시 has_depth 클래스 추가 -->
 						<a href="#">상품</a>
 						<!-- 상품 depth -->
@@ -168,6 +168,44 @@
 			});
 	}
 
+	// 브랜드 추천상품
+	let fnCreateRecommendGoods = function (){
+		let tag = '';
+		$.getJSON('/display/brand/gnb/tab/recommend/goods/list?brandGroupNo='+[[${brandGroupInfo.brandGroupNo}]]+'&cate1No=2100&contentsLoc=SBM003&cateGb=G032_102'
+			, function(result, status){
+				if(status == 'success'){
+					var imgUrl = [[${@environment.getProperty('upload.goods.view')}]];
+					var contentsLocVal = 'SBM003';
+					if(result.length > 0){
+						tag+='<div className="list">';
+						tag+='	<ul className="clear event_con">';
+
+						$.each(result, function (idx, item){
+							tag+='		<li>';
+							tag+='			<div class="item_prod">';
+							tag+='				<div class="item_state">';
+							tag+='					<a href="javascript:void(0);" class=" itemLink" onclick="cfnGoToGoodsDetail(\'' + item.goodsCd + '\', \'\', \'\', \'' + contentsLocVal + '\');">';
+							tag+='						<div class="itemPic">';
+							tag+='						<img alt="BLACK-a" class=" vLHTC pd_img" src="'+imgUrl+'/'+item.sysImgNm+'">';
+							tag+='						</div>';
+							tag+='						<div class="itemName">'+item.goodsFullNm+'</div>';
+							tag+='						<p class="itemPrice">'+item.currPrice.addComma();
+							tag+='							<span class="itemPrice_original">'+item.listPrice.addComma()+'</span>';
+							tag+='						</p>';
+							tag+='					</a>';
+							tag+='				</div>';
+							tag+='			</div>';
+							tag+='		</li>';
+						});
+
+						tag+='	</ul>';
+						tag+='</div>';
+					}
+					$('#divGnbBrandBanner').append(tag);
+				}
+		});
+	}
+
 	$(document).ready(function() {
 		//검색창 호출
 		$(".common_search").load("sch_layer_pop.html");
@@ -202,6 +240,9 @@
 		
 		// 브랜드 카테고리 생성
 		fnCreateBrandCategory();
+
+		// 브랜드 추천상품 생성
+		fnCreateRecommendGoods();
 		
 		// GNB탭 생성
 		fnCreateGnbTab();