Просмотр исходного кода

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

libo лет назад: 4
Родитель
Сommit
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 28
      * @param merId 商户ID
29
+     * @param limit 数量
29 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 66
                         .withValueList(List.of(row.getAttr_values().split("-!-"))).build()).toList())
67 67
                 .withMerchant(merchantVo)
68 68
                 .withAttr_value(productAttrValueVo)
69
-                .withRecommend_list(productMapper.selectList(merchantVo.getId()))
69
+                .withRecommend_list(productMapper.selectList(merchantVo.getId(), 3))
70 70
                 .build();
71 71
     }
72 72
 

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

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