Explorar o código

* 商品详情-推荐列表,设置最多三条限制

libo %!s(int64=4) %!d(string=hai) anos
pai
achega
215918e3ec

+ 3 - 1
src/main/java/com/tdba/cxb/ares/api/repository/ProductMapper.java

@@ -26,7 +26,9 @@ public interface ProductMapper {
26
     /**
26
     /**
27
      * 商品列表
27
      * 商品列表
28
      * @param merId 商户ID
28
      * @param merId 商户ID
29
+     * @param limit 数量
29
      * @return
30
      * @return
30
      */
31
      */
31
-    List<ProductSimple> selectList(@Param("merId") Integer merId);
32
+    List<ProductSimple> selectList(@Param("merId") Integer merId,
33
+                                   @Param("limit") Integer limit);
32
 }
34
 }

+ 1 - 1
src/main/java/com/tdba/cxb/ares/api/service/ProductService.java

@@ -66,7 +66,7 @@ public class ProductService {
66
                         .withValueList(List.of(row.getAttr_values().split("-!-"))).build()).toList())
66
                         .withValueList(List.of(row.getAttr_values().split("-!-"))).build()).toList())
67
                 .withMerchant(merchantVo)
67
                 .withMerchant(merchantVo)
68
                 .withAttr_value(productAttrValueVo)
68
                 .withAttr_value(productAttrValueVo)
69
-                .withRecommend_list(productMapper.selectList(merchantVo.getId()))
69
+                .withRecommend_list(productMapper.selectList(merchantVo.getId(), 3))
70
                 .build();
70
                 .build();
71
     }
71
     }
72
 
72
 

+ 4 - 0
src/main/resources/mapper/ProductMapper.xml

@@ -38,5 +38,9 @@
38
           and status = 1
38
           and status = 1
39
           and is_used = 1
39
           and is_used = 1
40
           and mer_id = #{merId}
40
           and mer_id = #{merId}
41
+
42
+        <if test="limit != null">
43
+            limit #{limit}
44
+        </if>
41
     </select>
45
     </select>
42
 </mapper>
46
 </mapper>