Przeglądaj źródła

多小程序增加商品种类单选配置,商品列表增加多选商品种类配置

peicj 2 tygodni temu
rodzic
commit
1f4703fa89
19 zmienionych plików z 131 dodań i 69 usunięć
  1. 8 0
      fs-admin/src/main/java/com/fs/store/controller/FsStoreProductController.java
  2. 7 3
      fs-admin/src/main/java/com/fs/web/controller/system/FsCoursePlaySourceConfigController.java
  3. 6 3
      fs-service-system/src/main/java/com/fs/store/domain/FsCoursePlaySourceConfig.java
  4. 2 2
      fs-service-system/src/main/java/com/fs/store/domain/FsStoreProduct.java
  5. 2 2
      fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductAttrValueMapper.java
  6. 40 19
      fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductMapper.java
  7. 1 2
      fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAddEditParam.java
  8. 1 1
      fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAttrValueQueryParam.java
  9. 4 1
      fs-service-system/src/main/java/com/fs/store/param/FsStoreProductQueryParam.java
  10. 7 7
      fs-service-system/src/main/java/com/fs/store/service/IFsStoreProductService.java
  11. 7 7
      fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreProductServiceImpl.java
  12. 1 1
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductExportVO.java
  13. 1 1
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductListVO.java
  14. 2 0
      fs-service-system/src/main/java/com/fs/system/param/FsCoursePlaySourceConfigCreateParam.java
  15. 2 0
      fs-service-system/src/main/java/com/fs/system/param/FsCoursePlaySourceConfigEditParam.java
  16. 11 4
      fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml
  17. 14 2
      fs-service-system/src/main/resources/mapper/system/FsCoursePlaySourceConfigMapper.xml
  18. 6 6
      fs-user-app/src/main/java/com/fs/app/controller/AppBaseController.java
  19. 9 8
      fs-user-app/src/main/java/com/fs/app/controller/ProductController.java

+ 8 - 0
fs-admin/src/main/java/com/fs/store/controller/FsStoreProductController.java

@@ -65,6 +65,10 @@ public class FsStoreProductController extends BaseController
     {
         startPage();
         List<FsStoreProductListVO> list;
+        if(!StringUtils.isNullOrEmpty(fsStoreProduct.getProductKind())){
+            fsStoreProduct.setProductKindList(fsStoreProduct.getProductKind().split(","));
+            fsStoreProduct.setProductKind(null);
+        }
         if(StringUtils.isNullOrEmpty(fsStoreProduct.getBarCode())){
             list = fsStoreProductService.selectFsStoreProductListVO(fsStoreProduct);
         }else{
@@ -81,6 +85,10 @@ public class FsStoreProductController extends BaseController
     @GetMapping("/export")
     public AjaxResult export(FsStoreProduct fsStoreProduct)
     {
+        if(!StringUtils.isNullOrEmpty(fsStoreProduct.getProductKind())){
+            fsStoreProduct.setProductKindList(fsStoreProduct.getProductKind().split(","));
+            fsStoreProduct.setProductKind(null);
+        }
         List<FsStoreProductExportVO> list = fsStoreProductService.selectFsStoreProductExportList(fsStoreProduct);
         ExcelUtil<FsStoreProductExportVO> util = new ExcelUtil<FsStoreProductExportVO>(FsStoreProductExportVO.class);
         return util.exportExcel(list, "storeProduct");

+ 7 - 3
fs-admin/src/main/java/com/fs/web/controller/system/FsCoursePlaySourceConfigController.java

@@ -1,6 +1,5 @@
 package com.fs.web.controller.system;
 
-import cn.hutool.json.JSONUtil;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -8,6 +7,7 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.bean.BeanUtils;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
@@ -23,7 +23,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.time.LocalDateTime;
 import java.util.*;
 
 @RestController
@@ -43,7 +42,8 @@ public class FsCoursePlaySourceConfigController extends BaseController {
                               @RequestParam(required = false, defaultValue = "1") Integer pageNum,
                               @RequestParam(required = false, defaultValue = "10") Integer pageSize,
                               @RequestParam(required = false) Long companyId,
-                              @RequestParam(required = false) Integer specialMini
+                              @RequestParam(required = false) Integer specialMini,
+                              @RequestParam(required = false) String productKind
     ) {
         FsCoursePlaySourceConfig fsCoursePlaySourceConfig = new FsCoursePlaySourceConfig();
         fsCoursePlaySourceConfig.setName(name);
@@ -54,6 +54,10 @@ public class FsCoursePlaySourceConfigController extends BaseController {
         if (specialMini != null){
             fsCoursePlaySourceConfig.setSpecialMini(specialMini);
         }
+        if(StringUtils.isNotBlank(productKind)){
+            fsCoursePlaySourceConfig.setProductKindList(productKind.split(","));
+            fsCoursePlaySourceConfig.setProductKind(null);
+        }
         PageHelper.startPage(pageNum, pageSize);
         List<FsCoursePlaySourceConfig> list = fsCoursePlaySourceConfigService.selectFsCoursePlaySourceConfigList(fsCoursePlaySourceConfig);
         return getDataTable(list);

+ 6 - 3
fs-service-system/src/main/java/com/fs/store/domain/FsCoursePlaySourceConfig.java

@@ -4,9 +4,6 @@ import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.time.LocalDateTime;
-import java.util.List;
-
 /**
  * 点播播放源配置对象 fs_course_play_source_config
  *
@@ -80,4 +77,10 @@ public class FsCoursePlaySourceConfig extends BaseEntity {
      */
     private Integer specialMini;
 
+    /**
+     * 商品种类:1.普通商品2.保健品3.药品
+     */
+    private String productKind;
+
+    private String[] productKindList;
 }

+ 2 - 2
fs-service-system/src/main/java/com/fs/store/domain/FsStoreProduct.java

@@ -3,7 +3,6 @@ package com.fs.store.domain;
 import java.math.BigDecimal;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -191,6 +190,7 @@ public class FsStoreProduct extends BaseEntity
     private Integer specialProducts;
 
     @Excel(name = "商品种类:1.普通商品2.保健品3.药品")
-    private Integer productKind;
+    private String productKind;
 
+    private String[] productKindList;
 }

+ 2 - 2
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductAttrValueMapper.java

@@ -109,7 +109,7 @@ public interface FsStoreProductAttrValueMapper
             "and p.tui_cate_id =#{maps.tuiCateId} " +
             "</if>" +
             "<if test = 'maps.productKind != null    '> " +
-            "and p.product_kind =#{maps.productKind} " +
+            "and FIND_IN_SET(#{maps.productKind}, p.product_kind) " +
             "</if>" +
             " order by v.id desc "+
             "</script>"})
@@ -127,4 +127,4 @@ public interface FsStoreProductAttrValueMapper
             " order by v.id desc "+
             "</script>"})
     List<FsStoreTuiProductAttrValueVO> selectStoreTuiProductAttrValueVOList(@Param("maps")FsStoreTuiProductAttrValueParam param);
-}
+}

+ 40 - 19
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductMapper.java

@@ -86,8 +86,15 @@ public interface FsStoreProductMapper
             "<if test = 'maps.specialProducts != null    '> " +
             "and p.special_products =#{maps.specialProducts} " +
             "</if>" +
-            "<if test = 'maps.productKind != null    '> " +
-            "and p.product_kind =#{maps.productKind} " +
+            "<if test = 'maps.productKind != null  and  maps.productKind !=\"\" '> " +
+            "and FIND_IN_SET(#{maps.productKind}, p.product_kind) " +
+            "</if>" +
+            "<if test = 'maps.productKindList != null and maps.productKindList.length > 0   '> " +
+            "and (\n" +
+            "                <foreach collection=\"maps.productKindList\" item=\"item\" separator=\" or \">\n" +
+            "                    FIND_IN_SET(#{item}, p.product_kind)\n" +
+            "                </foreach>\n" +
+            "                )" +
             "</if>" +
             " order by p.product_id desc "+
             "</script>"})
@@ -120,7 +127,14 @@ public interface FsStoreProductMapper
             "and p.warehouse_code =#{maps.warehouseCode} " +
             "</if>" +
             "<if test = 'maps.productKind != null    '> " +
-            "and p.product_kind =#{maps.productKind} " +
+            "and FIND_IN_SET(#{maps.productKind}, p.product_kind) " +
+            "</if>" +
+            "<if test = 'maps.productKindList != null and maps.productKindList.length > 0   '> " +
+            "and (\n" +
+            "                <foreach collection=\"maps.productKindList\" item=\"item\" separator=\" or \">\n" +
+            "                    FIND_IN_SET(#{item}, p.product_kind)\n" +
+            "                </foreach>\n" +
+            "                )" +
             "</if>" +
             " order by p.product_id desc "+
             "</script>"})
@@ -128,10 +142,10 @@ public interface FsStoreProductMapper
 
     @Select({"<script> " +
             "select * from fs_store_product where is_del=0 and is_show=1 and is_best=1 and is_display=1 " +
-            "<if test = 'productKind != null'> and product_kind = #{productKind} </if>" +
+            "<if test = 'productKind != null'> and FIND_IN_SET(#{productKind}, product_kind) </if>" +
             " order by sort desc limit #{count}" +
             "</script>"})
-    List<FsStoreProductListQueryVO> selectFsStoreProductTuiQuery(@Param("count") int count, @Param("productKind") Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiQuery(@Param("count") int count, @Param("productKind") String productKind);
     @Select("select * from fs_store_product where  is_del=0 and is_show=1 order by sort desc limit #{count}")
     List<FsStoreProductListQueryVO> selectFsStoreProductByCateIdQuery(Long cateId);
     @Select({"<script> " +
@@ -150,7 +164,14 @@ public interface FsStoreProductMapper
             "and p.special_products =#{maps.specialProducts}  " +
             "</if>" +
             "<if test = 'maps.productKind != null    '> " +
-            "and p.product_kind =#{maps.productKind} " +
+            "and FIND_IN_SET(#{maps.productKind}, p.product_kind) " +
+            "</if>" +
+            "<if test = 'maps.productKindList != null and maps.productKindList.length > 0   '> " +
+            "and (\n" +
+            "                <foreach collection=\"maps.productKindList\" item=\"item\" separator=\" or \">\n" +
+            "                    FIND_IN_SET(#{item}, p.product_kind)\n" +
+            "                </foreach>\n" +
+            "                )" +
             "</if>" +
             "<if test = 'maps.defaultOrder != null and maps.defaultOrder==\"desc\"  '> " +
             "order by p.sort desc " +
@@ -175,9 +196,9 @@ public interface FsStoreProductMapper
     @Select({"<script> " +
             "select p.* from fs_store_product p  " +
             "where is_del=0 and is_show=1 and product_id=#{productId} " +
-            "<if test = 'productKind != null'> and p.product_kind = #{productKind} </if>" +
+            "<if test = 'productKind != null'> and FIND_IN_SET(#{productKind}, p.product_kind) </if>" +
             "</script>"})
-    FsStoreProductQueryVO selectFsStoreProductByIdQuery(@Param("productId") Long productId, @Param("productKind") Integer productKind);
+    FsStoreProductQueryVO selectFsStoreProductByIdQuery(@Param("productId") Long productId, @Param("productKind") String productKind);
     @Update("update fs_store_product set stock=stock-#{num}, sales=sales+#{num}" +
             " where product_id=#{productId} and stock >= #{num}")
     int decProductAttrStock(@Param("productId")Long productId, @Param("num")Integer cartNum);
@@ -194,34 +215,34 @@ public interface FsStoreProductMapper
     List<FsStoreProductListQueryVO> selectFsStoreProductHotQuerySp(int count);
     @Select({"<script> " +
             "select * from fs_store_product where is_del=0 and is_show=1 and is_good=1 and is_display=1 " +
-            "<if test = 'productKind != null'> and product_kind = #{productKind} </if>" +
+            "<if test = 'productKind != null'> and FIND_IN_SET(#{productKind}, product_kind)</if>" +
             " order by sort desc limit #{count}" +
             "</script>"})
-    List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(@Param("count") int count, @Param("productKind") Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(@Param("count") int count, @Param("productKind") String productKind);
     @Select({"<script> " +
             "select * from fs_store_product where is_del=0 and is_show=1 and is_best=1 and is_display=1 " +
-            "<if test = 'productKind != null'> and product_kind = #{productKind} </if>" +
+            "<if test = 'productKind != null'> and FIND_IN_SET(#{productKind}, product_kind) </if>" +
             " order by sort desc" +
             "</script>"})
-    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(@Param("productKind") Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(@Param("productKind") String productKind);
     @Select({"<script> " +
             "select * from fs_store_product where is_del=0 and is_show=1 and is_best=1 and is_display=1 and special_products=1 " +
-            "<if test = 'productKind != null'> and product_kind = #{productKind} </if>" +
+            "<if test = 'productKind != null'> and FIND_IN_SET(#{productKind}, product_kind) </if>" +
             " order by sort desc" +
             "</script>"})
-    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp(@Param("productKind") Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp(@Param("productKind") String productKind);
     @Select({"<script> " +
             "select * from fs_store_product where is_del=0 and is_show=1 and is_good=1 and is_display=1 " +
-            "<if test = 'productKind != null'> and product_kind = #{productKind} </if>" +
+            "<if test = 'productKind != null'> and FIND_IN_SET(#{productKind}, product_kind) </if>" +
             " order by sort desc" +
             "</script>"})
-    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery(@Param("productKind") Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery(@Param("productKind") String productKind);
     @Select({"<script> " +
             "select * from fs_store_product where is_del=0 and is_show=1 and is_good=1 and is_display=1 and special_products=1 " +
-            "<if test = 'productKind != null'> and product_kind = #{productKind} </if>" +
+            "<if test = 'productKind != null'> and FIND_IN_SET(#{productKind}, product_kind) </if>" +
             " order by sort desc" +
             "</script>"})
-    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp(@Param("productKind") Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp(@Param("productKind") String productKind);
     @Select({"<script> " +
             "select count(1) from fs_store_product  " +
             "where 1=1 " +
@@ -266,4 +287,4 @@ public interface FsStoreProductMapper
 
 
 
-}
+}

+ 1 - 2
fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAddEditParam.java

@@ -1,6 +1,5 @@
 package com.fs.store.param;
 
-import com.fs.common.annotation.Excel;
 import com.fs.store.domain.FsStoreProductAttrValue;
 import com.fs.store.dto.ProductArrtDTO;
 import lombok.Data;
@@ -124,7 +123,7 @@ public class FsStoreProductAddEditParam implements Serializable
     private Integer productType;
 
     /** 商品种类:1.普通商品2.保健品3.药品 */
-    private Integer productKind;
+    private String productKind;
 
     /** 国药准字 */
     private String prescribeCode;

+ 1 - 1
fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAttrValueQueryParam.java

@@ -15,6 +15,6 @@ public class FsStoreProductAttrValueQueryParam extends BaseQueryParam implements
     @ApiModelProperty(value = "推广分类")
     Integer tuiCateId;
     @ApiModelProperty(value = "商品种类")
-    private Integer productKind;
+    private String productKind;
 
 }

+ 4 - 1
fs-service-system/src/main/java/com/fs/store/param/FsStoreProductQueryParam.java

@@ -26,5 +26,8 @@ public class FsStoreProductQueryParam extends BaseQueryParam implements Serializ
     private String appId;
     private Integer specialProducts;
     @ApiModelProperty(value = "商品种类")
-    private Integer productKind;
+    private String productKind;
+
+    private String[] productKindList;
+
 }

+ 7 - 7
fs-service-system/src/main/java/com/fs/store/service/IFsStoreProductService.java

@@ -75,12 +75,12 @@ public interface IFsStoreProductService
 
     R addOrEdit(FsStoreProductAddEditParam fsStoreProduct);
 
-    List<FsStoreProductListQueryVO> selectFsStoreProductTuiQuery(int count, Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiQuery(int count, String productKind);
 
 
     List<FsStoreProductListQueryVO> selectFsStoreProductListQuery(FsStoreProductQueryParam param);
 
-    FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId, Integer productKind);
+    FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId, String productKind);
 
     void decProductStock(Long productId, Long productAttrValueId, Integer cartNum);
 
@@ -93,13 +93,13 @@ public interface IFsStoreProductService
     List<FsStoreProductListQueryVO> selectFsStoreProductHotQuery(int count);
     List<FsStoreProductListQueryVO> selectFsStoreProductHotQuerySp(int count);
 
-    List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count, Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count, String productKind);
 
-    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(Integer productKind);
-    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp(Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(String productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp(String productKind);
 
-    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery(Integer productKind);
-    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp(Integer productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery(String productKind);
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp(String productKind);
 
     Long selectFsStoreProductCount(int type);
 

+ 7 - 7
fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreProductServiceImpl.java

@@ -553,7 +553,7 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
     }
 
     @Override
-    public List<FsStoreProductListQueryVO> selectFsStoreProductTuiQuery(int count, Integer productKind) {
+    public List<FsStoreProductListQueryVO> selectFsStoreProductTuiQuery(int count, String productKind) {
         return fsStoreProductMapper.selectFsStoreProductTuiQuery(count, productKind);
     }
 
@@ -565,7 +565,7 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
     }
 
     @Override
-    public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId, Integer productKind) {
+    public FsStoreProductQueryVO selectFsStoreProductByIdQuery(Long productId, String productKind) {
         return fsStoreProductMapper.selectFsStoreProductByIdQuery(productId, productKind);
     }
 
@@ -609,27 +609,27 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
     }
 
     @Override
-    public List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count, Integer productKind) {
+    public List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count, String productKind) {
         return fsStoreProductMapper.selectFsStoreProductGoodQuery(count, productKind);
     }
 
     @Override
-    public List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(Integer productKind) {
+    public List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery(String productKind) {
         return fsStoreProductMapper.selectFsStoreProductTuiListQuery(productKind);
     }
 
     @Override
-    public List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp(Integer productKind) {
+    public List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp(String productKind) {
         return fsStoreProductMapper.selectFsStoreProductTuiListQuerySp(productKind);
     }
 
     @Override
-    public List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery(Integer productKind) {
+    public List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery(String productKind) {
         return fsStoreProductMapper.selectFsStoreProductGoodListQuery(productKind);
     }
 
     @Override
-    public List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp(Integer productKind) {
+    public List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp(String productKind) {
         return fsStoreProductMapper.selectFsStoreProductGoodListQuerySp(productKind);
     }
 

+ 1 - 1
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductExportVO.java

@@ -197,5 +197,5 @@ public class FsStoreProductExportVO implements Serializable {
     private String warehouseCode;
 
     @Excel(name = "商品种类:1.普通商品2.保健品3.药品")
-    private Integer productKind;
+    private String productKind;
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductListVO.java

@@ -86,5 +86,5 @@ public class FsStoreProductListVO  implements Serializable
     /**
      * 商品种类:1.普通商品2.保健品3.药品
      */
-    private Integer productKind;
+    private String productKind;
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/system/param/FsCoursePlaySourceConfigCreateParam.java

@@ -59,4 +59,6 @@ public class FsCoursePlaySourceConfigCreateParam {
     private Integer status;
     @ApiModelProperty("是否是特殊小程序 0否 1是")
     private Integer specialMini;
+    @ApiModelProperty("商品种类:1.普通商品2.保健品3.药品")
+    private String productKind;
 }

+ 2 - 0
fs-service-system/src/main/java/com/fs/system/param/FsCoursePlaySourceConfigEditParam.java

@@ -56,4 +56,6 @@ public class FsCoursePlaySourceConfigEditParam {
     private Integer status;
     @ApiModelProperty("是否是特殊小程序 0否 1是")
     private Integer specialMini;
+    @ApiModelProperty("商品种类:1.普通商品2.保健品3.药品")
+    private String productKind;
 }

+ 11 - 4
fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml

@@ -101,7 +101,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="warehouseId != null"> and warehouse_id = #{warehouseId}</if>
             <if test="warehouseCode != null"> and warehouse_code = #{warehouseCode}</if>
             <if test="specialProducts != null"> and special_products = #{specialProducts}</if>
-            <if test="productKind != null"> and product_kind = #{productKind}</if>
+            <if test="productKind != null and productKind != ''"> and FIND_IN_SET(#{productKind}, product_kind)</if>
+            <if test="productKindList != null and productKindList.length > 0">
+                and (
+                <foreach collection="productKindList" item="item" separator=" or ">
+                    FIND_IN_SET(#{item}, product_kind)
+                </foreach>
+                )
+            </if>
         </where>
     </select>
 
@@ -157,7 +164,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="warehouseId != null">warehouse_id,</if>
             <if test="warehouseCode != null">warehouse_code,</if>
             <if test="specialProducts != null">special_products,</if>
-            <if test="productKind != null">product_kind,</if>
+            <if test="productKind != null and productKind != ''">product_kind,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="image != null and image != ''">#{image},</if>
@@ -204,7 +211,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="warehouseId != null">#{warehouseId},</if>
             <if test="warehouseCode != null">#{warehouseCode},</if>
             <if test="specialProducts != null">#{specialProducts},</if>
-            <if test="productKind != null">#{productKind},</if>
+            <if test="productKind != null and productKind != ''">#{productKind},</if>
          </trim>
     </insert>
 
@@ -255,7 +262,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
             <if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if>
             <if test="specialProducts != null">special_products = #{specialProducts},</if>
-            <if test="productKind != null">product_kind = #{productKind},</if>
+            <if test="productKind != null and productKind != ''">product_kind = #{productKind},</if>
         </trim>
         where product_id = #{productId}
     </update>

+ 14 - 2
fs-service-system/src/main/resources/mapper/system/FsCoursePlaySourceConfigMapper.xml

@@ -21,10 +21,11 @@
         <result property="createDeptId"    column="create_dept_id"    />
         <result property="status"    column="status"    />
         <result property="specialMini"    column="special_mini"    />
+        <result property="productKind"    column="product_kind"    />
     </resultMap>
 
     <sql id="selectFsCoursePlaySourceConfigVo">
-        select id, name, appid,status, secret, img, original_id, token, aes_key, msg_data_format,is_del, create_time, update_time, create_user_id, create_dept_id,special_mini from fs_course_play_source_config
+        select id, name, appid,status, secret, img, original_id, token, aes_key, msg_data_format,is_del, create_time, update_time, create_user_id, create_dept_id,special_mini,product_kind from fs_course_play_source_config
     </sql>
 
     <select id="selectFsCoursePlaySourceConfigList" parameterType="FsCoursePlaySourceConfig" resultMap="FsCoursePlaySourceConfigResult">
@@ -43,6 +44,14 @@
             <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
             <if test="createDeptId != null "> and create_dept_id = #{createDeptId}</if>
             <if test="specialMini != null "> and special_mini = #{specialMini}</if>
+            <if test="productKind != null  and productKind != '' "> and FIND_IN_SET(#{productKind}, product_kind)</if>
+            <if test="productKindList != null and productKindList.length > 0">
+                and (
+                <foreach collection="productKindList" item="item" separator=" or ">
+                    FIND_IN_SET(#{item}, product_kind)
+                </foreach>
+                )
+            </if>
         </where>
     </select>
 
@@ -72,6 +81,7 @@
             <if test="createDeptId != null">create_dept_id,</if>
             <if test="status != null">`status`,</if>
             <if test="specialMini != null">`special_mini`,</if>
+            <if test="productKind != null and productKind != ''">`product_kind`,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="name != null and name != ''">#{name},</if>
@@ -89,6 +99,7 @@
             <if test="createDeptId != null">#{createDeptId},</if>
             <if test="status != null">#{status},</if>
             <if test="specialMini != null">#{specialMini},</if>
+            <if test="productKind != null and productKind != ''">#{productKind},</if>
         </trim>
     </insert>
 
@@ -110,6 +121,7 @@
             <if test="createDeptId != null">create_dept_id = #{createDeptId},</if>
             <if test="status != null">`status` = #{status},</if>
             <if test="specialMini != null">`special_mini` = #{specialMini},</if>
+            <if test="productKind != null and productKind != ''">`product_kind` = #{productKind},</if>
         </trim>
         where id = #{id}
     </update>
@@ -132,4 +144,4 @@
         <include refid="selectFsCoursePlaySourceConfigVo"/>
         where is_del = 0 and `status` = 0
     </select>
-</mapper>
+</mapper>

+ 6 - 6
fs-user-app/src/main/java/com/fs/app/controller/AppBaseController.java

@@ -37,19 +37,19 @@ public class AppBaseController {
 	}
 
 	/**
-	 * 获取商品种类,默认为1
+	 * 获取商品种类,默认为-1,表示小程序没有配置,目前仅支持传一个商品种类
 	 */
-	protected Integer getProductKind()
+	protected String getProductKind()
 	{
 		String headValue = ServletUtils.getRequest().getHeader("productKind");
 		if (StringUtils.isNotEmpty(headValue)) {
 			try {
-				return Integer.parseInt(headValue);
-			} catch (NumberFormatException e) {
-				return 1;
+				return headValue;
+			} catch (Exception e) {
+				return "-1";
 			}
 		}
-		return 1;
+		return "-1";
 	}
 
 	protected boolean isCurrentUser(Long userId) {

+ 9 - 8
fs-user-app/src/main/java/com/fs/app/controller/ProductController.java

@@ -4,6 +4,7 @@ package com.fs.app.controller;
 import com.fs.app.annotation.Login;
 import com.fs.common.core.domain.R;
 import com.fs.common.param.BaseQueryParam;
+import com.fs.common.utils.StringUtils;
 import com.fs.store.domain.*;
 import com.fs.store.param.*;
 import com.fs.store.service.*;
@@ -42,15 +43,15 @@ public class ProductController extends  AppBaseController {
     private IFsCoursePlaySourceConfigService coursePlaySourceConfigService;
 
     private void applyProductKind(FsStoreProductQueryParam param) {
-        Integer productKind = getProductKind();
-        if (productKind != null) {
+        String productKind = getProductKind();
+        if (StringUtils.isNotBlank(productKind)) {
             param.setProductKind(productKind);
         }
     }
 
     private void applyProductKind(FsStoreProductAttrValueQueryParam param) {
-        Integer productKind = getProductKind();
-        if (productKind != null) {
+        String productKind = getProductKind();
+        if (StringUtils.isNotBlank(productKind)) {
             param.setProductKind(productKind);
         }
     }
@@ -299,7 +300,7 @@ public class ProductController extends  AppBaseController {
         }
         PageHelper.startPage(param.getPage(), param.getPageSize());
         List<FsStoreProductListQueryVO> list = new ArrayList<>();
-        Integer productKind = getProductKind();
+        String productKind = getProductKind();
         if (flag){
             list=productService.selectFsStoreProductTuiListQuerySp(productKind);
         }else {
@@ -321,7 +322,7 @@ public class ProductController extends  AppBaseController {
         }
         PageHelper.startPage(param.getPage(), param.getPageSize());
         List<FsStoreProductListQueryVO> list = new ArrayList<>();
-        Integer productKind = getProductKind();
+        String productKind = getProductKind();
         if (flag){
             list=productService.selectFsStoreProductTuiListQuerySp(productKind);
         }else {
@@ -342,7 +343,7 @@ public class ProductController extends  AppBaseController {
         }
         PageHelper.startPage(param.getPage(), param.getPageSize());
         List<FsStoreProductListQueryVO> list = new ArrayList<>();
-        Integer productKind = getProductKind();
+        String productKind = getProductKind();
         if (flag){
             list=productService.selectFsStoreProductGoodListQuerySp(productKind);
         }else {
@@ -365,7 +366,7 @@ public class ProductController extends  AppBaseController {
         }
         PageHelper.startPage(param.getPage(), param.getPageSize());
         List<FsStoreProductListQueryVO> list = new ArrayList<>();
-        Integer productKind = getProductKind();
+        String productKind = getProductKind();
         if (flag){
             list=productService.selectFsStoreProductGoodListQuerySp(productKind);
         }else {