ソースを参照

coding:多小程序和商品 新增是否特殊字段

zhangqin 1 ヶ月 前
コミット
879b10657a

+ 0 - 1
fs-service-system/src/main/java/com/fs/common/param/BaseQueryParam.java

@@ -24,5 +24,4 @@ public class BaseQueryParam extends BaseEntity implements Serializable {
     private Integer limit;
     @ApiModelProperty(value = "搜索字符串")
     private String keyword;
-
 }

+ 13 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreProductMapper.java

@@ -136,6 +136,9 @@ public interface FsStoreProductMapper
             "<if test = 'maps.cateId != null    '> " +
             "and p.cate_id =#{maps.cateId}  " +
             "</if>" +
+            "<if test = 'maps.specialProducts != null    '> " +
+            "and p.special_products =#{maps.specialProducts}  " +
+            "</if>" +
             "<if test = 'maps.defaultOrder != null and maps.defaultOrder==\"desc\"  '> " +
             "order by p.sort desc " +
             "</if>" +
@@ -169,14 +172,22 @@ public interface FsStoreProductMapper
     int incStockDecSales( @Param("num")Long num, @Param("productId")Long productId);
     @Select("select * from fs_store_product where is_del=0 and is_show=1 and  is_new=1 and is_display=1 order by sort desc limit #{count}")
     List<FsStoreProductListQueryVO> selectFsStoreProductNewQuery(int count);
+    @Select("select * from fs_store_product where is_del=0 and is_show=1 and  is_new=1 and is_display=1 and special_products=1 order by sort desc limit #{count}")
+    List<FsStoreProductListQueryVO> selectFsStoreProductNewQuerySp(int count);
     @Select("select * from fs_store_product where is_del=0 and is_show=1 and  is_hot=1 and is_display=1 order by sort desc limit #{count}")
     List<FsStoreProductListQueryVO> selectFsStoreProductHotQuery(int count);
+    @Select("select * from fs_store_product where is_del=0 and is_show=1 and  is_hot=1 and is_display=1 and special_products=1 order by sort desc limit #{count}")
+    List<FsStoreProductListQueryVO> selectFsStoreProductHotQuerySp(int count);
     @Select("select * from fs_store_product where is_del=0 and is_show=1 and  is_good=1 and is_display=1 order by sort desc limit #{count}")
     List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count);
     @Select("select * from fs_store_product where is_del=0 and is_show=1 and  is_best=1 and is_display=1 order by sort desc")
     List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery();
+    @Select("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 order by sort desc")
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp();
     @Select("select * from fs_store_product where is_del=0 and is_show=1 and  is_good=1 and is_display=1 order by sort desc")
     List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery();
+    @Select("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 order by sort desc")
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp();
     @Select({"<script> " +
             "select count(1) from fs_store_product  " +
             "where 1=1 " +
@@ -219,4 +230,6 @@ public interface FsStoreProductMapper
             " on sp.warehouse_code=fw.warehouse_code ")
     Map<Long,FsStoreProduct> selectAllProductMappingInfo();
 
+
+
 }

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

@@ -23,5 +23,6 @@ public class FsStoreProductQueryParam extends BaseQueryParam implements Serializ
     private String salesOrder;
     @ApiModelProperty(value = "1 只显示商城展示的商品 0展示所有")
     private Integer isDisplay=1;
-
+    private String appId;
+    private Integer specialProducts;
 }

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

@@ -88,14 +88,18 @@ public interface IFsStoreProductService
 
 
     List<FsStoreProductListQueryVO> selectFsStoreProductNewQuery(int count);
+    List<FsStoreProductListQueryVO> selectFsStoreProductNewQuerySp(int count);
 
     List<FsStoreProductListQueryVO> selectFsStoreProductHotQuery(int count);
+    List<FsStoreProductListQueryVO> selectFsStoreProductHotQuerySp(int count);
 
     List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count);
 
     List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuery();
+    List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp();
 
     List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery();
+    List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp();
 
     Long selectFsStoreProductCount(int type);
 

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

@@ -593,11 +593,21 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
         return fsStoreProductMapper.selectFsStoreProductNewQuery(count);
     }
 
+    @Override
+    public List<FsStoreProductListQueryVO> selectFsStoreProductNewQuerySp(int count) {
+        return fsStoreProductMapper.selectFsStoreProductNewQuerySp(count);
+    }
+
     @Override
     public List<FsStoreProductListQueryVO> selectFsStoreProductHotQuery(int count) {
         return fsStoreProductMapper.selectFsStoreProductHotQuery(count);
     }
 
+    @Override
+    public List<FsStoreProductListQueryVO> selectFsStoreProductHotQuerySp(int count) {
+        return fsStoreProductMapper.selectFsStoreProductHotQuerySp(count);
+    }
+
     @Override
     public List<FsStoreProductListQueryVO> selectFsStoreProductGoodQuery(int count) {
         return fsStoreProductMapper.selectFsStoreProductGoodQuery(count);
@@ -608,11 +618,21 @@ public class FsStoreProductServiceImpl implements IFsStoreProductService
         return fsStoreProductMapper.selectFsStoreProductTuiListQuery();
     }
 
+    @Override
+    public List<FsStoreProductListQueryVO> selectFsStoreProductTuiListQuerySp() {
+        return fsStoreProductMapper.selectFsStoreProductTuiListQuerySp();
+    }
+
     @Override
     public List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuery() {
         return fsStoreProductMapper.selectFsStoreProductGoodListQuery();
     }
 
+    @Override
+    public List<FsStoreProductListQueryVO> selectFsStoreProductGoodListQuerySp() {
+        return fsStoreProductMapper.selectFsStoreProductGoodListQuerySp();
+    }
+
     @Override
     public Long selectFsStoreProductCount(int type) {
         return fsStoreProductMapper.selectFsStoreProductCount(type);

+ 23 - 3
fs-user-app/src/main/java/com/fs/app/controller/IndexController.java

@@ -57,14 +57,34 @@ public class IndexController extends AppBaseController {
 	private IFsMenuService menuService;
 	@Autowired
 	private IFsStoreCanvasService storeCanvasService;
+	@Autowired
+	private IFsCoursePlaySourceConfigService coursePlaySourceConfigService;
 
 	@ApiOperation("获取首页数据")
 	@GetMapping("/getIndexData")
-	public R getIndexData(){
+	public R getIndexData(String appId){
+		boolean flag=false;
+		if (appId!=null){
+			FsCoursePlaySourceConfig config = coursePlaySourceConfigService.selectFsCoursePlaySourceConfigByAppId(appId);
+			if (config!=null && config.getSpecialMini()==1){
+				flag = true;
+			}
+		}
 		List<FsArticleCateListQueryVO> articleCateList=articleCateService.selectFsArticleCateListQuery();
 		List<FsAdvListQueryVO> advList=advService.selectFsAdvListQuery(1);
-		List<FsStoreProductListQueryVO> newProductList=productService.selectFsStoreProductNewQuery(10);
-		List<FsStoreProductListQueryVO> hotProductList=productService.selectFsStoreProductHotQuery(10);
+		List<FsStoreProductListQueryVO> newProductList;
+		if (flag){
+			newProductList=productService.selectFsStoreProductNewQuerySp(10);
+		}else {
+			newProductList=productService.selectFsStoreProductNewQuery(10);
+		}
+		List<FsStoreProductListQueryVO> hotProductList;
+		if (flag){
+			hotProductList=productService.selectFsStoreProductHotQuerySp(10);
+		}else {
+			hotProductList=productService.selectFsStoreProductHotQuery(10);
+		}
+
 		IndexVO vo=IndexVO.builder().articleCateList(articleCateList).advList(advList).newProductList(newProductList).hotProductList(hotProductList).build();
 		return R.ok().put("data", vo);
 	}

+ 37 - 4
fs-user-app/src/main/java/com/fs/app/controller/ProductController.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -37,6 +38,8 @@ public class ProductController extends  AppBaseController {
     private IFsStoreCartService cartService;
     @Autowired
     private IFsStoreProductRelationService productRelationService;
+    @Autowired
+    private IFsCoursePlaySourceConfigService coursePlaySourceConfigService;
 
     /**
      * 获取用户信息
@@ -73,6 +76,12 @@ public class ProductController extends  AppBaseController {
     @ApiOperation("获取商品列表")
     @GetMapping("/getProducts")
     public R getProducts(FsStoreProductQueryParam param){
+        if (param.getAppId()!=null){
+            FsCoursePlaySourceConfig config = coursePlaySourceConfigService.selectFsCoursePlaySourceConfigByAppId(param.getAppId());
+            if (config!=null && config.getSpecialMini()==1){
+                param.setSpecialProducts(1);
+            }
+        }
         PageHelper.startPage(param.getPage(), param.getPageSize());
         param.setIsDisplay(1);
         List<FsStoreProductListQueryVO> productList=productService.selectFsStoreProductListQuery(param);
@@ -168,17 +177,41 @@ public class ProductController extends  AppBaseController {
     }
     @ApiOperation("获取推荐商品数据")
     @GetMapping("/getTuiProducts")
-    public R getTuiProducts(BaseQueryParam param){
+    public R getTuiProducts(BaseQueryParam param,String appId){
+        boolean flag=false;
+        if (appId!=null){
+            FsCoursePlaySourceConfig config = coursePlaySourceConfigService.selectFsCoursePlaySourceConfigByAppId(appId);
+            if (config!=null && config.getSpecialMini()==1){
+                flag = true;
+            }
+        }
         PageHelper.startPage(param.getPage(), param.getPageSize());
-        List<FsStoreProductListQueryVO> list=productService.selectFsStoreProductTuiListQuery();
+        List<FsStoreProductListQueryVO> list = new ArrayList<>();
+        if (flag){
+            list=productService.selectFsStoreProductTuiListQuerySp();
+        }else {
+            list=productService.selectFsStoreProductTuiListQuery();
+        }
         PageInfo<FsStoreProductListQueryVO> listPageInfo=new PageInfo<>(list);
         return R.ok().put("data",listPageInfo);
     }
     @ApiOperation("获取喜欢商品数据")
     @GetMapping("/getGoodsProducts")
-    public R getGoodsProducts(BaseQueryParam param){
+    public R getGoodsProducts(BaseQueryParam param,String appId){
+        boolean flag=false;
+        if (appId!=null){
+            FsCoursePlaySourceConfig config = coursePlaySourceConfigService.selectFsCoursePlaySourceConfigByAppId(appId);
+            if (config!=null && config.getSpecialMini()==1){
+                flag = true;
+            }
+        }
         PageHelper.startPage(param.getPage(), param.getPageSize());
-        List<FsStoreProductListQueryVO> list=productService.selectFsStoreProductGoodListQuery();
+        List<FsStoreProductListQueryVO> list = new ArrayList<>();
+        if (flag){
+            list=productService.selectFsStoreProductGoodListQuerySp();
+        }else {
+            list=productService.selectFsStoreProductGoodListQuery();
+        }
         PageInfo<FsStoreProductListQueryVO> listPageInfo=new PageInfo<>(list);
         return R.ok().put("data",listPageInfo);