Browse Source

bugfix-相关推荐列表

Aslee 2 years ago
parent
commit
7b3228e43b

+ 1 - 7
src/main/java/com/caimei/www/mapper/BaikeDao.java

@@ -1,12 +1,6 @@
 package com.caimei.www.mapper;
 
 import com.caimei.www.pojo.baike.*;
-import com.caimei.www.pojo.classify.Bigtype;
-import com.caimei.www.pojo.classify.SmallType;
-import com.caimei.www.pojo.order.CartItem;
-import com.caimei.www.pojo.page.Parameter;
-import com.caimei.www.pojo.page.ProductDetail;
-import com.caimei.www.pojo.page.ProductList;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -46,6 +40,6 @@ public interface BaikeDao {
 
     List<BaikeProduct> getManualRecommendList(Integer productId);
 
-    List<BaikeProduct> getAutoRecommendList(@Param("shopId") Integer shopId, @Param("typeId") Integer typeId, @Param("productId") Integer productId);
+    List<BaikeProduct> getAutoRecommendList(Integer publishSource, @Param("shopId") Integer shopId, @Param("typeId") Integer typeId, @Param("productId") Integer productId);
 
 }

+ 1 - 1
src/main/java/com/caimei/www/service/page/impl/ProductServiceImpl.java

@@ -298,7 +298,7 @@ public class ProductServiceImpl implements ProductService {
                 // 手动推荐
                 recommendList = baikeDao.getManualRecommendList(productId);
             } else {
-                recommendList = baikeDao.getAutoRecommendList(baikeProduct.getShopId(), baikeProduct.getTypeId(), baikeProduct.getProductId());
+                recommendList = baikeDao.getAutoRecommendList(baikeProduct.getPublishSource(), baikeProduct.getShopId(), baikeProduct.getTypeId(), baikeProduct.getProductId());
             }
             recommendList.forEach(recommendProduct->{
                 // 问题列表

+ 5 - 4
src/main/resources/mapper/BaikeMapper.xml

@@ -76,12 +76,13 @@
 		select p.id as productId, p.commodityType, p.image, p.name, p.discription, p.publishTime, (p.basePv + p.actualPv) as pv
 		from cm_baike_product p
 		where typeId = #{typeId}
-		<if test="shopId != null">
-			and shopId = #{shopId}
-		</if>
-		<if test="shopId == null">
+		<if test="1 == publishSource">
 			and publishSource = 1
 		</if>
+		<if test="2 == publishSource">
+			and publishSource = 2
+			and shopId = #{shopId}
+		</if>
 		<if test="productId != null">
 			and id != #{productId}
 		</if>