Преглед на файлове

Merge remote-tracking branch 'origin/developer' into developerL

kaick преди 1 година
родител
ревизия
55c0d0edd3

+ 2 - 2
src/main/java/com/caimei365/user/controller/RoosInformationApi.java

@@ -59,8 +59,8 @@ public class RoosInformationApi {
      */
     @PostMapping("/insertRoos")
     public ResponseJson<String> insertRoosInformation(RoosInformationDto roosInformationDto) {
-        if (null == roosInformationDto.getShopId()) {
-            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        if (null == roosInformationDto.getShopProductId()) {
+            return ResponseJson.error(-1, "供应商商品Id不能为空", null);
         }
         // 获取访问ip
         String ip = roosInformationService.obtainIp();

+ 128 - 7
src/main/java/com/caimei365/user/controller/ShopApi.java

@@ -2,11 +2,7 @@ package com.caimei365.user.controller;
 
 import com.caimei365.user.idempotent.IpSave;
 import com.caimei365.user.model.ResponseJson;
-import com.caimei365.user.model.dto.BaikeProductDto;
-import com.caimei365.user.model.dto.ShopArticleDto;
-import com.caimei365.user.model.dto.ShopBannerDto;
-import com.caimei365.user.model.dto.ShopUpdateDto;
-import com.caimei365.user.model.po.BaikeProductPo;
+import com.caimei365.user.model.dto.*;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.ShopService;
 import com.github.pagehelper.PageInfo;
@@ -15,6 +11,8 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -27,6 +25,7 @@ import java.util.Map;
  * @date : 2021/3/9
  */
 @Api(tags = "供应商用户API")
+@Slf4j
 @RestController
 @RequiredArgsConstructor
 @RequestMapping("/user/shop")
@@ -124,17 +123,139 @@ public class ShopApi {
         return shopService.getShopHomeData(shopId);
     }
 
+    /**
+     * 供应商主页列表配置列表
+     * @param shopId
+     * @param category
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @ApiOperation("供应商主页列表配置列表")
+    @GetMapping("/getShopCategory")
+    public ResponseJson<PaginationVo<CmShopCategoryVo>> getShopCategory(Integer shopId, String category,
+                                                                        @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                        @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        if (null == shopId) {
+            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        }
+        return shopService.getShopCategory(shopId, category, pageNum, pageSize);
+    }
+
+    /**
+     * 一键排序
+     * @param id
+     * @param sort
+     * @return
+     */
+    @ApiOperation("一键排序")
+    @GetMapping("/renewShopCategory")
+    public ResponseJson renewShopCategory(Integer id, Integer sort) {
+        if (null == id) {
+            return ResponseJson.error(-1, "id不能为空", null);
+        }
+        if (null == sort) {
+            return ResponseJson.error(-1, "排序值不能为空", null);
+        }
+        return shopService.renewShopCategory(id, sort);
+    }
+
+    /**
+     * 供应商商品类别回显
+     * @param id
+     * @return
+     */
+    @ApiOperation("供应商商品类别回显")
+    @GetMapping("/echoShopCategory")
+    public ResponseJson<CmShopCategoryVo> echoShopCategory(Integer id) {
+        if (null == id) {
+            return ResponseJson.error(-1, "供应商类别id不能为空", null);
+        }
+        return shopService.echoShopCategory(id);
+    }
+
+    /**
+     * 选择商品
+     * @param shopId
+     * @param categoryId
+     * @param name
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @ApiOperation("选择商品")
+    @GetMapping("/getShopProductList")
+    public ResponseJson<PaginationVo<ProductItemVo>> getShopProductList(Integer shopId, Integer categoryId, String name,
+                                                                        @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                        @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        if (null == shopId) {
+            return  ResponseJson.error(-1, "供应商Id不能为空", null);
+        }
+         return shopService.getShopProductList(shopId, categoryId, name, pageNum, pageSize);
+    }
+
+    /**
+     * 保存供应商类别
+     * @param jsonParamsDto
+     * @return
+     */
+    @ApiOperation("保存供应商类别")
+    @PostMapping("/saveShopCategory")
+    public ResponseJson saveShopCategory(JsonParamsDto jsonParamsDto) {
+        if (null == jsonParamsDto) {
+            return ResponseJson.error(-1, "类别信息不能为空", null);
+        }
+        if (StringUtils.isBlank(jsonParamsDto.getParams()) || StringUtils.isEmpty(jsonParamsDto.getParams())) {
+            return ResponseJson.error(-1, "类别信息不能为空", null);
+        }
+        return shopService.saveShopCategory(jsonParamsDto);
+    }
+
+    /**
+     * 删除供应商商品类别
+     * @param id
+     * @return
+     */
+    @ApiOperation("删除供应商商品类别")
+    @GetMapping("/removeCategory")
+    public ResponseJson removeCategory(Integer id) {
+        if (null == id) {
+            return ResponseJson.error(-1, "供应商类别Id不能为空", null);
+        }
+        return shopService.deleteCategory(id);
+    }
+
     /**
      * 供应商首页-轮播图片
      * @param shopId 供应商Id
      */
     @ApiOperation("供应商首页-轮播图片(旧:/supplier/home/images(supplierId))")
     @GetMapping("/home/images")
-    public ResponseJson<List<ShopBannerVo>> getShopHomeImages(Integer shopId) {
+    public ResponseJson<PaginationVo<ShopBannerVo>> getShopHomeImages(Integer shopId, String title,
+                                                                      @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                      @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
         if (null == shopId) {
             return ResponseJson.error("参数异常:供应商Id不能为空!", null);
         }
-        return shopService.getShopHomeImages(shopId);
+        return shopService.getShopHomeImages(shopId, title, pageNum, pageSize);
+    }
+
+    /**
+     * 供应商banner 排序
+     * @param id
+     * @param sort
+     * @return
+     */
+    @ApiOperation("供应商banner 排序")
+    @GetMapping("/renewShopBannerSort")
+    public ResponseJson renewShopBannerSort(Integer id, Integer sort) {
+        if (null == id) {
+            return ResponseJson.error(-1, "id不能为空", null);
+        }
+        if (null == sort) {
+            return ResponseJson.error(-1, "排序值不能为空", null);
+        }
+        return shopService.updateShopBannerSort(id, sort);
     }
 
     /**

+ 15 - 2
src/main/java/com/caimei365/user/mapper/RoosInformationMapper.java

@@ -35,6 +35,14 @@ public interface RoosInformationMapper {
      * @return
      */
    Integer getShopStatus(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("infoId") Integer infoId, @Param("keyword") String keyword);
+
+    /**
+     * 潜客供应商下商品id
+     * @param shopId
+     * @return
+     */
+   List<Integer> getShopProductIds(@Param("shopId") Integer shopId);
+
     /**
      * 供应商广告图
      * @param shopIds
@@ -44,14 +52,19 @@ public interface RoosInformationMapper {
 
     /**
      * 弹框样式
-     * @param shopId
      * @param productId
      * @param infoId
      * @param keyword
      * @return
      */
-   CmShopPopUpVo getShopPop(@Param("shopId") Integer shopId,@Param("productId")  Integer productId,@Param("infoId")  Integer infoId,@Param("keyword")  String keyword);
+   CmShopPopUpVo getShopPop(@Param("productId")  Integer productId,@Param("infoId")  Integer infoId,@Param("keyword")  String keyword);
 
+    /**
+     * 弹框样式
+     * @param shopId
+     * @return
+     */
+   CmShopPopUpVo getProductPop(@Param("shopId") Integer shopId);
     /**
      * 插入填写咨询人基本信息
      * @param roosInformationDto

+ 92 - 2
src/main/java/com/caimei365/user/mapper/ShopMapper.java

@@ -1,7 +1,6 @@
 package com.caimei365.user.mapper;
 
 import com.caimei365.user.model.dto.ShopUpdateDto;
-import com.caimei365.user.model.po.ArticlePo;
 import com.caimei365.user.model.po.ShopCertPo;
 import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.vo.*;
@@ -81,10 +80,101 @@ public interface ShopMapper {
      */
     String medicalPracticeLicense(Integer shopId);
 
+    /**
+     * 供应商商品类别
+     * @param shopId
+     * @param category
+     * @return
+     */
+    List<CmShopCategoryVo> getShopCategory(@Param("shopId") Integer shopId, @Param("category") String category);
+
+    /**
+     * 修改排序
+     * @param id
+     * @param sort
+     */
+    void updateCategorySort(@Param("id") Integer id, @Param("sort") Integer sort);
+
+    /**
+     * 获取供应商商品分类信息
+     * @param id
+     * @return
+     */
+    CmShopCategoryVo getShopCategoryById(@Param("id") Integer id);
+
+    /**
+     * 供应商类别商品
+     * @param categoryId
+     * @return
+     */
+    List<ProductItemVo> getCategoryProductById(@Param("categoryId") Integer categoryId);
+
+    /**
+     * 选择商品
+     * @param shopId
+     * @param name
+     * @return
+     */
+    List<ProductItemVo> getShopProductList(@Param("shopId") Integer shopId, @Param("name") String name);
+
+    /**
+     * 供应商已选择商品
+     * @param shopId
+     * @param categoryId
+     * @return
+     */
+    List<Integer> getCategoryProductIdList(@Param("shopId") Integer shopId, @Param("categoryId") Integer categoryId);
+
+    /**
+     * 添加供应商类别
+     * @param cmShopCategory
+     */
+    void insertCategory(CmShopCategoryVo cmShopCategory);
+
+    /**
+     * 添加供应商类别商品
+     * @param categoryId
+     * @param productId
+     */
+    void insertCategoryProduct(@Param("categoryId") Integer categoryId, @Param("productId") Integer productId);
+
+    /**
+     * 修改类别信息
+     * @param cmShopCategory
+     */
+    void updateCategory(CmShopCategoryVo cmShopCategory);
+
+    /**
+     * 删除类别商品
+     * @param categoryId
+     * @param productIdList
+     */
+    void updateCategoryProduct(@Param("categoryId") Integer categoryId, @Param("productIdList") List<Integer> productIdList);
+
+    /**
+     * 该列别瞎所有商品
+     * @param categoryId
+     * @return
+     */
+    List<Integer> getCategoryProductIds(@Param("categoryId") Integer categoryId);
+
+    /**
+     * 删除供应商商品类别
+     * @param id
+     */
+    void deleteCategory(@Param("id") Integer id);
+
     /**
      * 供应商首页-轮播图片
      */
-    List<ShopBannerVo> getShopHomeImages(Integer shopId);
+    List<ShopBannerVo> getShopHomeImages(@Param("shopId") Integer shopId, @Param("title") String title);
+
+    /**
+     * 排序
+     * @param id
+     * @param sort
+     */
+    void updateShopBannerSort(@Param("id") Integer id, @Param("sort") Integer sort);
     /**
      * 店铺促销活动
      */

+ 4 - 0
src/main/java/com/caimei365/user/model/dto/RoosInformationDto.java

@@ -19,6 +19,10 @@ public class RoosInformationDto {
      * 供应商Id
      */
     private Integer shopId;
+    /**
+     * 营销供应商商品Id
+     */
+    private Integer shopProductId;
     /**
      * 咨询姓名
      */

+ 5 - 0
src/main/java/com/caimei365/user/model/dto/ShopBannerDto.java

@@ -45,4 +45,9 @@ public class ShopBannerDto implements Serializable {
      */
     @ApiModelProperty("图片")
     private String image;
+    /**
+     * 排序值
+     */
+    @ApiModelProperty("排序值")
+    private Integer sort;
 }

+ 39 - 0
src/main/java/com/caimei365/user/model/vo/CmShopCategoryProductVo.java

@@ -0,0 +1,39 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : hzg
+ * @date : 2024/1/5
+ */
+@Data
+public class CmShopCategoryProductVo {
+
+    private Integer id;
+    /**
+     * 供应商商品分类Id
+     */
+    private Integer categoryId;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 添加时间
+     */
+    private String addTime;
+    /**
+     * 删除标记:0未删除,1已删除
+     */
+    private Integer delFlag;
+    /**
+     * 商品名称
+     */
+    private String name;
+    /**
+     * 商品图片
+     */
+    private String image;
+}

+ 48 - 0
src/main/java/com/caimei365/user/model/vo/CmShopCategoryVo.java

@@ -0,0 +1,48 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : hzg
+ * @date : 2024/1/5
+ */
+@Data
+public class CmShopCategoryVo {
+    private Integer id;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 类别名称
+     */
+    private String category;
+    /**
+     * 排序
+     */
+    private Integer sort;
+    /**
+     * 添加时间
+     */
+    private String addTime;
+    /**
+     * 删除标记:0未删除,1已删除
+     */
+    private Integer delFlag;
+    /**
+     * 商品数量
+     */
+    private Integer productNumber;
+    /**
+     * 商品Id集合
+     */
+    private String productIds;
+    /**
+     * 商品集合
+     */
+    private List<ProductItemVo> products;
+}

+ 4 - 0
src/main/java/com/caimei365/user/model/vo/CmShopPopUpVo.java

@@ -15,6 +15,10 @@ public class CmShopPopUpVo {
      * 供应商Id
      */
     private Integer shopId;
+    /**
+     * 营销供应商商品Id
+     */
+    private Integer shopProductId;
     /**
      * 图片
      */

+ 8 - 0
src/main/java/com/caimei365/user/model/vo/ProductItemVo.java

@@ -23,6 +23,10 @@ public class ProductItemVo implements Serializable {
      * 商品productID
      */
     private Integer productId;
+    /**
+     * 供应商商品分类Id
+     */
+    private Integer categoryId;
     /**
      * 名称name
      */
@@ -238,4 +242,8 @@ public class ProductItemVo implements Serializable {
      * 供应商名称回显
      */
     private String shopName;
+    /**
+     * 是否可选择
+     */
+    private Boolean flag;
 }

+ 8 - 0
src/main/java/com/caimei365/user/model/vo/ShopBannerVo.java

@@ -25,4 +25,12 @@ public class ShopBannerVo implements Serializable {
     private String info;
 
     private String image;
+    /**
+     * 排序值
+     */
+    private Integer sort;
+    /**
+     * 添加时间
+     */
+    private String addTime;
 }

+ 9 - 0
src/main/java/com/caimei365/user/model/vo/ShopHomeVo.java

@@ -3,6 +3,7 @@ package com.caimei365.user.model.vo;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * Description
@@ -90,4 +91,12 @@ public class ShopHomeVo implements Serializable {
      * 授权牌照
      */
     private String authorizationCertificateImage;
+    /**
+     * banner
+     */
+    private List<ShopBannerVo> shopHomeImages;
+    /**
+     * 商品类别
+     */
+    List<CmShopCategoryVo> shopCategory;
 }

+ 4 - 0
src/main/java/com/caimei365/user/model/vo/cmShopAdvertisingImage.java

@@ -17,6 +17,10 @@ public class cmShopAdvertisingImage {
      * 供应商Id
      */
     private String shopId;
+    /**
+     * 营销供应商商品Id
+     */
+    private String shopProductId;
     /**
      * pc图片
      */

+ 63 - 5
src/main/java/com/caimei365/user/service/ShopService.java

@@ -2,10 +2,7 @@ package com.caimei365.user.service;
 
 
 import com.caimei365.user.model.ResponseJson;
-import com.caimei365.user.model.dto.BaikeProductDto;
-import com.caimei365.user.model.dto.ShopArticleDto;
-import com.caimei365.user.model.dto.ShopBannerDto;
-import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.dto.*;
 import com.caimei365.user.model.vo.*;
 import com.github.pagehelper.PageInfo;
 
@@ -81,11 +78,72 @@ public interface ShopService {
      */
     ResponseJson<ShopHomeVo> getShopHomeData(Integer shopId);
 
+    /**
+     * 供应商主页列表配置列表
+     * @param shopId
+     * @param category
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PaginationVo<CmShopCategoryVo>> getShopCategory(Integer shopId, String category, int pageNum, int pageSize);
+
+    /**
+     * 一键排序
+     * @param id
+     * @param sort
+     * @return
+     */
+    ResponseJson renewShopCategory(Integer id, Integer sort);
+
+    /**
+     * 供应商商品类别回显
+     * @param id
+     * @return
+     */
+    ResponseJson<CmShopCategoryVo> echoShopCategory(Integer id);
+
+    /**
+     * 选择商品
+     * @param shopId
+     * @param categoryId
+     * @param name
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PaginationVo<ProductItemVo>> getShopProductList(Integer shopId, Integer categoryId, String name, int pageNum, int pageSize);
+
+    /**
+     * 保存商品类别
+     * @param jsonParamsDto
+     * @return
+     */
+    ResponseJson saveShopCategory(JsonParamsDto jsonParamsDto);
+
+    /**
+     * 删除供应商商品类别
+     * @param id
+     * @return
+     */
+    ResponseJson deleteCategory(Integer id);
+
     /**
      * 供应商首页-轮播图片
      * @param shopId 供应商Id
+     * @param title 标题
+     * @param pageNum
+     * @param pageSize
+     */
+    ResponseJson<PaginationVo<ShopBannerVo>> getShopHomeImages(Integer shopId, String title, int pageNum, int pageSize);
+
+    /**
+     * 一键排序
+     * @param id
+     * @param sort
+     * @return
      */
-    ResponseJson<List<ShopBannerVo>> getShopHomeImages(Integer shopId);
+    ResponseJson updateShopBannerSort(Integer id, Integer sort);
 
     /**
      * 供应商个人中心数据

+ 24 - 2
src/main/java/com/caimei365/user/service/impl/RoosInformationServiceImpl.java

@@ -58,13 +58,24 @@ public class RoosInformationServiceImpl implements RoosInformationService {
         log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
         // 供应商不存在或者处于不统计状态 不显示弹框
         Integer shopStatus = roosInformationMapper.getShopStatus(shopId, productId, infoId, keyword);
+        List<Integer> shopProductIds = roosInformationMapper.getShopProductIds(shopId);
         log.info("shopStatus===="+shopStatus);
+        // 网站底部的每个商品的弹窗,只在浏览了该商品相关的文章详情,商品详情和搜索列表后才显示,而不是该供应商的任意一个商品都显示
         if (null != shopStatus && 0 != shopStatus) {
             isClick = false;
         }
         if (null == shopStatus) {
             isClick = false;
         }
+        // 若一个供应商只添加了一个商品,则游客在浏览该供应商主页时,就显示该商品的底部弹窗
+        if (null != shopId) {
+            if (null != list && list.size() > 0 && list.stream().allMatch(i -> i == 0)
+                    && null != shopStatus && 0 == shopStatus && null != shopProductIds && shopProductIds.size() == 1) {
+                isClick = true;
+            } else {
+                isClick = false;
+            }
+        }
         return isClick;
     }
 
@@ -80,7 +91,18 @@ public class RoosInformationServiceImpl implements RoosInformationService {
     @Override
     public ResponseJson<CmShopPopUpVo> getPopUpInfo(Integer shopId, Integer productId, Integer infoId, String keyword) {
         log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
-        CmShopPopUpVo shopPop = roosInformationMapper.getShopPop(shopId, productId, infoId, keyword);
+        CmShopPopUpVo shopPop = new CmShopPopUpVo();
+        if (null != shopId) {
+            List<Integer> shopProductIds = roosInformationMapper.getShopProductIds(shopId);
+            if (null != shopProductIds && shopProductIds.size() == 1) {
+                shopPop = roosInformationMapper.getProductPop(shopId);
+            }
+        } else {
+            shopPop = roosInformationMapper.getShopPop(productId, infoId, keyword);
+        }
+        if (null == shopPop) {
+            return ResponseJson.error(-1, "信息异常", null);
+        }
         log.info("shopPop====="+shopPop);
         return ResponseJson.success(shopPop);
     }
@@ -113,7 +135,7 @@ public class RoosInformationServiceImpl implements RoosInformationService {
         String format = simpleDateFormat.format(new Date());
         // 供应商集合
         List<Integer> shopIds = new ArrayList<>();
-        // 该用户是否访问过香干供应商相关页面
+        // 该用户是否访问过相关供应商相关页面
         List<Integer> shopIdList = roosInformationMapper.getShopId();
         for (Integer shopId : shopIdList) {
             List<Integer> behavior = null;

+ 218 - 15
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -6,10 +6,7 @@ import com.caimei365.user.components.RedisService;
 import com.caimei365.user.feign.CommodityFeign;
 import com.caimei365.user.mapper.*;
 import com.caimei365.user.model.ResponseJson;
-import com.caimei365.user.model.dto.BaikeProductDto;
-import com.caimei365.user.model.dto.ShopArticleDto;
-import com.caimei365.user.model.dto.ShopBannerDto;
-import com.caimei365.user.model.dto.ShopUpdateDto;
+import com.caimei365.user.model.dto.*;
 import com.caimei365.user.model.po.*;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.ShopService;
@@ -36,6 +33,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import static com.alibaba.fastjson.JSON.parseObject;
+
 /**
  * Description
  *
@@ -326,18 +325,205 @@ public class ShopServiceImpl implements ShopService {
         if (null != taxLicense && taxLicense.size() > 0) {
             supplier.setMedicalPracticeLicenseImg3(taxLicense.get(0));
         }
+        // banner
+        List<ShopBannerVo> shopHomeImages = shopMapper.getShopHomeImages(shopId, null);
+        supplier.setShopHomeImages(shopHomeImages);
+        // 商品类别
+        List<CmShopCategoryVo> shopCategory = shopMapper.getShopCategory(shopId, null);
+        supplier.setShopCategory(shopCategory);
         return ResponseJson.success(supplier);
     }
 
+    /**
+     * 供应商主页列表配置列表
+     *
+     * @param shopId
+     * @param category
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PaginationVo<CmShopCategoryVo>> getShopCategory(Integer shopId, String category, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmShopCategoryVo> shopCategory = shopMapper.getShopCategory(shopId, category);
+        PaginationVo<CmShopCategoryVo> page = new PaginationVo<>(shopCategory);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 一键排序
+     *
+     * @param id
+     * @param sort
+     * @return
+     */
+    @Override
+    public ResponseJson renewShopCategory(Integer id, Integer sort) {
+        shopMapper.updateCategorySort(id, sort);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 供应商商品类别回显
+     *
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson<CmShopCategoryVo> echoShopCategory(Integer id) {
+        CmShopCategoryVo shopCategoryById = shopMapper.getShopCategoryById(id);
+        List<ProductItemVo> categoryProductList = shopMapper.getCategoryProductById(id);
+        categoryProductList.forEach(product -> {
+            product.setImage(ImageUtils.getImageURL("product", product.getImage(), 0 , wwwDomain));
+        });
+        shopCategoryById.setProducts(categoryProductList);
+        return ResponseJson.success(shopCategoryById);
+    }
+
+    /**
+     * 选择商品
+     *
+     * @param shopId
+     * @param categoryId
+     * @param name
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PaginationVo<ProductItemVo>> getShopProductList(Integer shopId, Integer categoryId, String name, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ProductItemVo> shopProductList = shopMapper.getShopProductList(shopId, name);
+        // 供应商已选择商品, 同类别不可重复选择
+        List<Integer> categoryProductIdList =  new ArrayList<>();
+        if (null != categoryId) {
+            categoryProductIdList = shopMapper.getCategoryProductIdList(shopId, categoryId);
+        }
+        for (ProductItemVo product : shopProductList) {
+            product.setImage(ImageUtils.getImageURL("product", product.getImage(), 0 , wwwDomain));
+            if (null != categoryProductIdList && categoryProductIdList.contains(product.getProductId())) {
+                product.setFlag(false);
+            } else {
+                product.setFlag(true);
+            }
+        }
+        PaginationVo<ProductItemVo> page = new PaginationVo<>(shopProductList);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 保存商品类别
+     *
+     * @param jsonParamsDto
+     * @return
+     */
+    @Override
+    public ResponseJson saveShopCategory(JsonParamsDto jsonParamsDto) {
+        try {
+            // 处理json数据
+            JSONObject jsonObject = parseObject(jsonParamsDto.getParams());
+            Integer id = jsonObject.getInteger("id");
+            Integer shopId = jsonObject.getInteger("shopId");
+            String category = jsonObject.getString("category");
+            Integer sort = jsonObject.getInteger("sort");
+            String productIds = jsonObject.getString("productIds");
+            if (null == shopId) {
+                return ResponseJson.error(-1, "供应商Id不能为空", null);
+            }
+            if (StringUtils.isBlank(category) || StringUtils.isEmpty(category)) {
+                return ResponseJson.error(-1, "类别名称不能为空", null);
+            }
+            if (null == sort) {
+                return ResponseJson.error(-1, "类别排序不能为空", null);
+            }
+            if (StringUtils.isBlank(productIds) || StringUtils.isEmpty(productIds)) {
+                return ResponseJson.error(-1, "商品不能为空", null);
+            }
+            CmShopCategoryVo cmShopCategoryVo = new CmShopCategoryVo();
+            cmShopCategoryVo.setId(id);
+            cmShopCategoryVo.setShopId(shopId);
+            cmShopCategoryVo.setCategory(category);
+            cmShopCategoryVo.setSort(sort);
+            cmShopCategoryVo.setProductIds(productIds);
+            if(null == id) {
+                // 新增
+                shopMapper.insertCategory(cmShopCategoryVo);
+            } else {
+                // 修改
+                shopMapper.updateCategory(cmShopCategoryVo);
+            }
+            Integer categoryId = cmShopCategoryVo.getId();
+
+            if (StringUtils.isNotBlank(cmShopCategoryVo.getProductIds())) {
+                // 处理类别商品
+                List<Integer> productIdList = new ArrayList<>();
+                // 该类别下所有商品
+                List<Integer> categoryProductIds = shopMapper.getCategoryProductIds(categoryId);
+                if (cmShopCategoryVo.getProductIds().contains(",")) {
+                    String[] productIdArr = cmShopCategoryVo.getProductIds().split(",");
+                    for (String productId : productIdArr) {
+                        int proId = Integer.parseInt(productId);
+                        productIdList.add(proId);
+                        if (!categoryProductIds.contains(proId)) {
+                            shopMapper.insertCategoryProduct(categoryId, proId);
+                        }
+                    }
+                } else {
+                    int proId = Integer.parseInt(cmShopCategoryVo.getProductIds());
+                    productIdList.add(proId);
+                    if (!categoryProductIds.contains(proId)) {
+                        shopMapper.insertCategoryProduct(categoryId, proId);
+                    }
+                }
+                // 排除不在该商品类别的商品
+                if(productIdList.size() > 0) {
+                    shopMapper.updateCategoryProduct(categoryId, productIdList);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return ResponseJson.success();
+    }
+
+    /**
+     * 删除供应商商品类别
+     *
+     * @param id
+     * @return
+     */
+    @Override
+    public ResponseJson deleteCategory(Integer id) {
+        shopMapper.deleteCategory(id);
+        return ResponseJson.success();
+    }
+
     /**
      * 供应商首页-轮播图片
      *
      * @param shopId 供应商Id
+     * @param title 标题
      */
     @Override
-    public ResponseJson<List<ShopBannerVo>> getShopHomeImages(Integer shopId) {
-        List<ShopBannerVo> images = shopMapper.getShopHomeImages(shopId);
-        return ResponseJson.success(images);
+    public ResponseJson<PaginationVo<ShopBannerVo>> getShopHomeImages(Integer shopId, String title, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ShopBannerVo> images = shopMapper.getShopHomeImages(shopId, title);
+        PaginationVo<ShopBannerVo> page = new PaginationVo<>(images);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 一键排序
+     *
+     * @param id
+     * @param sort
+     * @return
+     */
+    @Override
+    public ResponseJson updateShopBannerSort(Integer id, Integer sort) {
+        shopMapper.updateShopBannerSort(id, sort);
+        return ResponseJson.success();
     }
 
     /**
@@ -359,13 +545,14 @@ public class ShopServiceImpl implements ShopService {
         if (null != shopBannerDto.getId()) {
             // 更新
             shopBanner.setId(shopBannerDto.getId());
+            shopBanner.setSort(shopBanner.getSort());
             shopMapper.updateShopHomeImage(shopBanner);
         } else {
             // 新增
-            int count = shopMapper.getShopHomeImageCount(shopBannerDto.getShopId());
+            /*int count = shopMapper.getShopHomeImageCount(shopBannerDto.getShopId());
             if (count >= 4) {
                 return ResponseJson.error("主页广告图的上限是4张图!", null);
-            }
+            }*/
             shopMapper.insertShopHomeImage(shopBanner);
         }
         return ResponseJson.success(null);
@@ -1238,11 +1425,12 @@ public class ShopServiceImpl implements ShopService {
             }
             set = new HashSet<>();
             List<ReturnEntityVo> userIdentity1 = shopMapper.getUserIdentity(startTime, endTime, shopKeyword);
-            // 所有值之和
-            AtomicInteger maxUserValue = new AtomicInteger(0);
             if (null != userIdentity1 && userIdentity1.size() > 0) {
+                userIdentity1.removeIf( user -> StringUtils.isBlank(user.getName()));
+                // 所有值之和
+                AtomicInteger maxUserValue = new AtomicInteger(0);
                 for (ReturnEntityVo returnEntityVo : userIdentity1) {
-                    maxUserValue.updateAndGet(max -> max + Integer.parseInt(returnEntityVo.getValue()));
+                    // maxUserValue.set(MathUtil.add(Integer.parseInt(returnEntityVo.getValue()),maxUserValue.get()).intValue());
                     if (!set.contains(returnEntityVo.getName())) {
                         set.add(returnEntityVo.getName());
                         userIdentity.add(returnEntityVo);
@@ -1252,15 +1440,23 @@ public class ShopServiceImpl implements ShopService {
                         }
                     }
                 }
-                userIdentity.forEach(returnUserIdentity -> returnUserIdentity.setValue(MathUtil.div(returnUserIdentity.getValue(), maxUserValue.get(), 2).toString()));
+                userIdentity.forEach( user -> maxUserValue.set(MathUtil.add(Integer.parseInt(user.getValue()), maxUserValue.get()).intValue()));
+                userIdentity.forEach(returnUserIdentity -> {
+                    log.info("returnUserIdentity.getValue()==="+returnUserIdentity.getValue());
+                    log.info("maxUserValue.get()==="+maxUserValue.get());
+                    String values = MathUtil.mul(MathUtil.div(returnUserIdentity.getValue(), maxUserValue.get(), 2), 100).toString();
+                    log.info("values==="+values);
+                    returnUserIdentity.setValue(values);
+                });
             }
             set = new HashSet<>();
             List<ReturnEntityVo> clubType1 = shopMapper.getClubType(startTime, endTime, shopKeyword);
             if (null != clubType1 && clubType1.size() > 0) {
+                clubType1.removeIf( club -> StringUtils.isBlank(club.getName()));
                 // 所有值之和
                 AtomicInteger maxClubTypeValue = new AtomicInteger(0);
                 for (ReturnEntityVo returnEntityVo : clubType1) {
-                    maxClubTypeValue.updateAndGet(max -> max + Integer.parseInt(returnEntityVo.getValue()));
+                    // maxClubTypeValue.set(MathUtil.add(Integer.parseInt(returnEntityVo.getValue()), maxClubTypeValue.get()).intValue());
                     if (!set.contains(returnEntityVo.getName())) {
                         set.add(returnEntityVo.getName());
                         clubType.add(returnEntityVo);
@@ -1270,7 +1466,14 @@ public class ShopServiceImpl implements ShopService {
                         }
                     }
                 }
-                userIdentity.forEach(returnUserIdentity -> returnUserIdentity.setValue(MathUtil.div(returnUserIdentity.getValue(), maxClubTypeValue.get(), 2).toString()));
+                clubType.forEach( club -> maxClubTypeValue.set(MathUtil.add(Integer.parseInt(club.getValue()), maxClubTypeValue.get()).intValue()));
+                clubType.forEach(returnUserIdentity -> {
+                    log.info("returnUserIdentity.getValue()==="+returnUserIdentity.getValue());
+                    log.info("maxClubTypeValue.get()==="+maxClubTypeValue.get());
+                    String values = MathUtil.mul(MathUtil.div(returnUserIdentity.getValue(), maxClubTypeValue.get(), 2), 100).toString();
+                    log.info("values==="+values);
+                    returnUserIdentity.setValue(values);
+                });
             }
         }
         map.put("channels", regionMap);

+ 68 - 37
src/main/resources/mapper/RoosInformationMapper.xml

@@ -3,24 +3,23 @@
 <mapper namespace="com.caimei365.user.mapper.RoosInformationMapper">
     <select id="selIsClick" resultType="integer">
         SELECT isClick FROM cm_roos_information cri
-        <if test="productId != null">
-            LEFT JOIN product p ON p.shopId = cri.shopId
-        </if>
+            left join cm_shop_product csp on csp.id = cri.shopProductId
+            left join cm_shop_statistics css on css.id = csp.statisticsId
         <if test="infoId != null">
-            LEFT JOIN cm_shop_info csi ON csi.shopId = cri.shopId
+            LEFT JOIN cm_shop_info csi ON csi.shopProductId = csp.id
         </if>
         <if test="keyword != null and keyword != ''">
-            left join shop s on s.shopId = cri.shopId
-            LEFT JOIN cm_shop_keyword csk ON csk.shopId = cri.shopId
+            left join shop s on s.shopId = css.shopId
+            LEFT JOIN cm_shop_keyword csk ON csk.shopProductId = csp.id
             left join cm_user_search_frequency cusf on cusf.id = csk.searchId
         </if>
         <where>
             cri.IP = #{IP} and cri.createTime LIKE concat('%',#{createTime},'%')
             <if test="shopId != null">
-                and cri.shopId = #{shopId}
+                and css.shopId = #{shopId}
             </if>
             <if test="productId != null">
-                and p.productId = #{productId}
+                and csp.productId = #{productId}
             </if>
             <if test="infoId != null">
                 and csi.status = 0
@@ -33,26 +32,24 @@
     </select>
 
     <select id="getShopStatus" resultType="java.lang.Integer">
-        select css.status
+        select csp.status
         from cm_shop_statistics css
-        <if test="productId != null">
-            LEFT JOIN product p ON p.shopId = css.shopId
-        </if>
+        left join cm_shop_product csp on csp.statisticsId = css.id
         <if test="infoId != null">
-            LEFT JOIN cm_shop_info csi ON csi.shopId = css.shopId
+            LEFT JOIN cm_shop_info csi ON csi.shopProductId = csp.id
         </if>
         <if test="keyword != null and keyword != ''">
             left join shop s on s.shopId = css.shopId
-            LEFT JOIN cm_shop_keyword csk ON csk.shopId = css.shopId
+            LEFT JOIN cm_shop_keyword csk ON csk.shopProductId = csp.id
             left join cm_user_search_frequency cusf on cusf.id = csk.searchId
         </if>
         <where>
-            css.delFlag = 0
+            css.delFlag = 0 and css.status = 0 AND csp.delFlag = 0
             <if test="shopId != null">
                 and css.shopId = #{shopId}
             </if>
             <if test="productId != null">
-                and p.productId = #{productId}
+                and csp.productId = #{productId}
             </if>
             <if test="infoId != null">
                 and csi.status = 0
@@ -65,6 +62,14 @@
         limit 1
     </select>
 
+    <select id="getShopProductIds" resultType="java.lang.Integer">
+        SELECT
+            csp.id
+        FROM cm_shop_product csp
+                 LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
+        WHERE css.shopId = #{shopId} AND csp.delFlag = 0
+    </select>
+
     <select id="getShopAdvert" resultType="com.caimei365.user.model.vo.cmShopAdvertisingImage">
         select csa.* from cm_shop_advertisingImage csa
         left join cm_shop_statistics cps on csa.shopId = cps.shopId
@@ -81,48 +86,61 @@
     <select id="getShopPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
         SELECT
           csp.id,
-          csp.shopId,
+          css.shopId,
+          cspd.id as shopProductId,
           csp.image,
           csp.guidingOne,
           csp.guidingTwo,
           csp.addTime
         FROM cm_shop_popUp csp
-        left join cm_shop_statistics css on css.shopId = csp.shopId
-        <if test="productId != null">
-            LEFT JOIN product p ON p.shopId = csp.shopId
-        </if>
+        left join cm_shop_product cspd on cspd.id = csp.shopProductId
+        left join cm_shop_statistics css on cspd.statisticsId = css.id
          <if test="infoId != null">
-            LEFT JOIN cm_shop_info csi ON csi.shopId = csp.shopId
+            LEFT JOIN cm_shop_info csi ON csi.shopProductId = cspd.id
          </if>
         <if test="keyword != null and keyword != ''">
-            left join shop s on s.shopId = csp.shopId
-            LEFT JOIN cm_shop_keyword csk ON csk.shopId = csp.shopId
+            LEFT JOIN cm_shop_keyword csk ON csk.shopId = cspd.id
             left join cm_user_search_frequency cusf on cusf.id = csk.searchId
         </if>
         <where>
-            css.status = 0
-            <if test="shopId != null">
-                and csp.shopId = #{shopId}
-            </if>
+            css.status = 0 and cspd.status = 0 and cspd.delFlag = 0
             <if test="productId != null">
-                and p.productId = #{productId}
+                and cspd.productId = #{productId}
             </if>
             <if test="infoId != null">
                 and csi.status = 0
                 and csi.infoId = #{infoId}
             </if>
             <if test="keyword != null and keyword != ''">
-                and (csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%')
+                and csk.status = 0
+                and cusf.keyword like concat('%',#{keyword},'%')
             </if>
         </where>
         limit 1
     </select>
 
+    <select id="getProductPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
+        SELECT
+            csp.id,
+            css.shopId,
+            cspd.id as shopProductId,
+            csp.image,
+            csp.guidingOne,
+            csp.guidingTwo,
+            csp.addTime
+        FROM cm_shop_popUp csp
+        left join cm_shop_product cspd on cspd.id = csp.shopProductId
+        left join cm_shop_statistics css on css.id = cspd.statisticsId
+        where css.shopId = #{shopId}
+          AND cspd.delFlag = 0
+        limit 1
+    </select>
+
     <insert id="insRoosInformation">
         INSERT INTO cm_roos_information
             (
              IP,
-             shopId,
+             shopProductId,
              <if test="consultName != null and consultName != ''">
                  consultName,
              </if>
@@ -134,7 +152,7 @@
              )
         VALUES(
                #{ip},
-               #{shopId},
+               #{shopProductId},
                <if test="consultName != null and consultName != ''">
                 #{consultName},
                </if>
@@ -155,14 +173,27 @@
     </select>
 
     <select id="getShopInfoId" resultType="java.lang.Integer">
-        select infoId from cm_shop_info where shopId = #{shopId} and status = 0 and delFlag = 0
+        select
+            csi.infoId
+        FROM cm_shop_info csi
+        LEFT JOIN cm_shop_product csp ON csp.id = csi.shopProductId
+            LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
+        WHERE css.shopId = #{shopId}
+          AND csi.status = 0 AND csi.delFlag = 0
+          AND csp.status = 0 AND csp.delFlag = 0
+          AND css.status = 0 AND css.delFlag = 0
     </select>
 
     <select id="getShopKeyword" resultType="java.lang.String">
-        select cusf.keyword
-        from cm_shop_keyword csk
-        left join cm_user_search_frequency cusf on cusf.id = csk.searchId
-        where csk.shopId = #{shopId} and csk.status = 0 and csk.delFlag = 0
+        SELECT cusf.keyword
+        FROM cm_shop_keyword csk
+                 LEFT JOIN cm_user_search_frequency cusf ON cusf.id = csk.searchId
+                 LEFT JOIN cm_shop_product csp ON csp.id = csk.shopProductId
+                 LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
+        WHERE css.shopId = #{shopId}
+          AND csk.status = 0 AND csk.delFlag = 0
+          AND csp.status = 0 AND csp.delFlag = 0
+          AND css.status = 0 AND css.delFlag = 0
     </select>
 
     <select id="getBehavior" resultType="java.lang.Integer">

+ 144 - 6
src/main/resources/mapper/ShopMapper.xml

@@ -153,10 +153,147 @@
     <select id="medicalPracticeLicense" resultType="java.lang.String">
         SELECT medicalPracticeLicenseImg1 FROM shop WHERE shopID = #{shopId}
     </select>
+
+    <select id="getShopCategory" resultType="com.caimei365.user.model.vo.CmShopCategoryVo">
+        SELECT
+            csc.id,
+            csc.shopId,
+            csc.category,
+            csc.sort,
+            csc.addTime,
+            csc.delFlag,
+            (SELECT COUNT(id) FROM cm_shop_category_product WHERE categoryId = csc.id) as productNumber
+        FROM cm_shop_category csc
+        WHERE csc.delFlag = 0 AND csc.shopId = #{shopId}
+        <if test="category != null and category != ''">
+            and csc.category like concat('%', #{category}, '%')
+        </if>
+        order by csc.sort asc
+    </select>
+
+    <update id="updateCategorySort">
+        update cm_shop_category
+        set sort = #{sort}
+        where id = #{id}
+    </update>
+
+    <select id="getShopCategoryById" resultType="com.caimei365.user.model.vo.CmShopCategoryVo">
+        SELECT
+            id,
+            shopId,
+            category,
+            sort,
+            addTime,
+            delFlag
+        FROM cm_shop_category
+        WHERE delFlag = 0 AND id = #{id}
+        limit 1
+    </select>
+
+    <select id="getCategoryProductById" resultType="com.caimei365.user.model.vo.ProductItemVo">
+        SELECT
+            cscp.id,
+            cscp.categoryId,
+            cscp.productId,
+            p.name,
+            p.mainImage as image,
+            s.shopId,
+            s.name AS shopName
+        FROM cm_shop_category_product cscp
+                 LEFT JOIN product p ON p.productId = cscp.productId
+                 LEFT JOIN shop s ON s.shopId = p.shopId
+        WHERE cscp.delFlag = 0 AND cscp.categoryId = #{categoryId}
+    </select>
+
+    <select id="getShopProductList" resultType="com.caimei365.user.model.vo.ProductItemVo">
+        SELECT
+        p.productId,
+        p.name,
+        p.mainImage as image,
+        s.shopId,
+        s.name AS shopName
+        FROM product p
+        LEFT JOIN cm_organize_product_info copi ON copi.productId = p.productId
+        LEFT JOIN shop s ON s.shopId = p.shopId
+        <where>
+            copi.organizeId = 0 AND copi.validFlag = 2
+            and p.shopId = #{shopId}
+            <if test="name != null and name != ''">
+                and p.name like concat('%', #{name}, '%')
+            </if>
+        </where>
+    </select>
+
+    <select id="getCategoryProductIdList" resultType="java.lang.Integer">
+        SELECT
+            cscp.productId
+        FROM cm_shop_category_product cscp
+                 LEFT JOIN cm_shop_category csc ON csc.id = cscp.categoryId
+        WHERE csc.shopId = #{shopId} and cscp.categoryId = #{categoryId} and cscp.delFlag = 0
+    </select>
+
+    <insert id="insertCategory" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
+        insert into cm_shop_category(shopId, category, sort, addTime, delFlag)
+        values (#{shopId}, #{category}, #{sort}, now(), 0)
+    </insert>
+
+    <insert id="insertCategoryProduct">
+        insert into cm_shop_category_product(categoryId, productId, addTime, delFlag)
+        values (#{categoryId}, #{productId}, now(), 0)
+    </insert>
+
+    <update id="updateCategory">
+        update cm_shop_category
+        set category = #{category},
+            sort = #{sort}
+        where id = #{id}
+    </update>
+
+    <update id="updateCategoryProduct">
+        update cm_shop_category_product
+        set delFlag = 1
+        where categoryId = #{categoryId}
+        <if test="productIdList.size()>0">
+            and productId not in
+            <foreach collection="productIdList" item="productId" open="(" separator="," close=")">
+                #{productId}
+            </foreach>
+        </if>
+    </update>
+
+    <select id="getCategoryProductIds" resultType="java.lang.Integer">
+        select productId from cm_shop_category_product where categoryId = #{categoryId}
+    </select>
+
+    <update id="deleteCategory">
+        update cm_shop_category
+        set delFlag = 1
+        where id = #{id}
+    </update>
+
     <select id="getShopHomeImages" resultType="com.caimei365.user.model.vo.ShopBannerVo">
-        select shopBannerID AS id, shopID AS shopId, image, link, title, info
-        from shopbanner where shopID = #{shopId}
+        select shopBannerID AS id,
+               shopID AS shopId,
+               image,
+               link,
+               title,
+               info,
+               sort,
+               addTime
+        from shopbanner
+        where shopID = #{shopId}
+        <if test="title != null and title != ''">
+            and title like concat('%', #{title}, '%')
+        </if>
+        order by sort asc
     </select>
+
+    <update id="updateShopBannerSort">
+        update shopbanner
+        set sort = #{sort}
+        where shopBannerID = #{id}
+    </update>
+
     <select id="getShopPromotionsByShopId" resultType="com.caimei365.user.model.vo.PromotionsVo">
         select  pr.id,
                 pr.name,
@@ -252,12 +389,12 @@
         SELECT COUNT(*) FROM shopbanner WHERE shopID = #{shopId}
     </select>
     <insert id="insertShopHomeImage">
-        INSERT INTO shopbanner (shopID,title,link,info,image)
-        VALUES (#{shopId},#{title},#{link},#{info},#{image})
+        INSERT INTO shopbanner (shopID,title,link,info,image, sort, addTime)
+        VALUES (#{shopId},#{title},#{link},#{info},#{image}, #{sort}, now())
     </insert>
     <update id="updateShopHomeImage">
         UPDATE shopbanner
-        SET title = #{title}, link = #{link}, info = #{info}, image = #{image}
+        SET title = #{title}, link = #{link}, info = #{info}, image = #{image}, sort = #{sort}
         WHERE shopBannerID = #{id}
     </update>
     <delete id="deleteShopHomeImage">
@@ -280,7 +417,8 @@
                </if>
                css.logo
         FROM cm_shop_statistics css
-                 LEFT JOIN cm_market_report cmr ON cmr.marketId = css.id
+                left join cm_shop_product csp on csp.statisticsId = css.id
+                 LEFT JOIN cm_market_report cmr ON cmr.marketId = csp.id
                  LEFT JOIN shop s ON s.shopId = css.shopId
         WHERE css.delFlag = 0
           <if test="type == 1">