Bladeren bron

3/9 完成产品营销数据的增删改查

chendayu 2 jaren geleden
bovenliggende
commit
2d1592e6ad
39 gewijzigde bestanden met toevoegingen van 1766 en 90 verwijderingen
  1. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/dto/PageDTO2.java
  2. 48 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductAddNewDTO.java
  3. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryAddNewDTO.java
  4. 0 23
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryPictureDTO.java
  5. 35 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryPictureUpateDTO.java
  6. 4 4
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryQueryPageDTO.java
  7. 1 1
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryUpdateDTO.java
  8. 40 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductMarketDataAddNewDTO.java
  9. 18 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductMarketDataQueryPageDTO.java
  10. 43 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductMarketDataUpdateDTO.java
  11. 35 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductPictureUpdateDTO.java
  12. 33 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductQueryPageDTO.java
  13. 57 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductUpdateDTO.java
  14. 14 2
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductCategoryPictureVO.java
  15. 43 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductMarketDataVO.java
  16. 35 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductPictureVO.java
  17. 64 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductVO.java
  18. 0 3
      PAS/src/main/java/cn/cslg/pas/controller/ProductCategoryController.java
  19. 88 0
      PAS/src/main/java/cn/cslg/pas/controller/ProductController.java
  20. 75 0
      PAS/src/main/java/cn/cslg/pas/controller/ProductMarketDataController.java
  21. 6 2
      PAS/src/main/java/cn/cslg/pas/domain/Product.java
  22. 4 3
      PAS/src/main/java/cn/cslg/pas/domain/ProductMarketData.java
  23. 10 2
      PAS/src/main/java/cn/cslg/pas/domain/asso/AssoProductCategoryPicture.java
  24. 10 2
      PAS/src/main/java/cn/cslg/pas/domain/asso/AssoProductPicture.java
  25. 2 2
      PAS/src/main/java/cn/cslg/pas/mapper/AssoProductCategoryPictureMapper.java
  26. 49 0
      PAS/src/main/java/cn/cslg/pas/mapper/AssoProductPictureMapper.java
  27. 81 0
      PAS/src/main/java/cn/cslg/pas/mapper/ProductMapper.java
  28. 69 0
      PAS/src/main/java/cn/cslg/pas/mapper/ProductMarketDataMapper.java
  29. 1 1
      PAS/src/main/java/cn/cslg/pas/service/IProductCategoryService.java
  30. 47 0
      PAS/src/main/java/cn/cslg/pas/service/IProductMarketDataService.java
  31. 54 0
      PAS/src/main/java/cn/cslg/pas/service/IProductService.java
  32. 43 32
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java
  33. 198 0
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductMarketDataIServicempl.java
  34. 235 0
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java
  35. 8 8
      PAS/src/main/resources/mapper/AssoProductCategoryPictureMapper.xml
  36. 7 3
      PAS/src/main/resources/mapper/ProductCategoryMapper.xml
  37. 140 0
      PAS/src/main/resources/mapper/ProductMapper.xml
  38. 112 0
      PAS/src/main/resources/mapper/ProductMarketDataMapper.xml
  39. 55 0
      PAS/src/main/resources/mapper/ProductPictureMapper.xml

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/dto/PageDTO2.java

@@ -9,7 +9,7 @@ import java.io.Serializable;
  * 分页查询前端传输DTO类
  *
  * @Author chenyu
- * @Data 2023/2/16
+ * @Date 2023/2/16
  */
 @Accessors(chain = true)
 @Data

+ 48 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductAddNewDTO.java

@@ -0,0 +1,48 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 产品的新增产品DTO类
+ */
+@Data
+@Accessors(chain = true)
+public class ProductAddNewDTO implements Serializable {
+    /**
+     * 产品名称
+     */
+    private String productName;
+    /**
+     * 上市时间
+     */
+    private Date marketTime;
+    /**
+     * 所属公司或租户名称
+     */
+    private String companyName;
+    /**
+     * 租户id
+     */
+    private Integer tenantId;
+    /**
+     * 产品说明
+     */
+    private String productExplain;
+    /**
+     * 所属产品类别id
+     */
+    private Integer productCategoryId;
+    /**
+     * 架构id
+     */
+    private Integer structureId;
+    /**
+     * 许可费率
+     */
+    private Double licenseRate;
+
+}

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryAddNewDTO.java

@@ -6,7 +6,7 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 产品类别的新增产品类别DTO类
+ * 新增产品类别DTO类
  */
 @Accessors(chain = true)
 @Data

+ 0 - 23
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryPictureDTO.java

@@ -1,23 +0,0 @@
-package cn.cslg.pas.common.model.dto;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * 产品类别的新增图片DTO类
- */
-@Accessors(chain = true)
-@Data
-public class ProductCategoryPictureDTO implements Serializable {
-    /**
-     * ID
-     */
-    private Integer id;
-    /**
-     * 图片路径
-     */
-    private String picture;
-
-}

+ 35 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryPictureUpateDTO.java

@@ -0,0 +1,35 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 产品类别的修改图片DTO类
+ */
+@Accessors(chain = true)
+@Data
+public class ProductCategoryPictureUpateDTO implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 产品类别ID
+     */
+    private Integer productCategoryId;
+    /**
+     * 图片名称
+     */
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
+
+}

+ 4 - 4
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryQueryPageDTO.java

@@ -16,10 +16,10 @@ public class ProductCategoryQueryPageDTO extends PageDTO2 {
      * 模糊查询-产品类别名称
      */
     private String productCategoryName;
-//    /**
-//     * 模糊查询-产品名称
-//     */
-//    private String productName;
+    /**
+     * 模糊查询-产品名称
+     */
+    private String productName;
     /**
      * 模糊查询-创建人名称
      */

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductCategoryUpdateDTO.java

@@ -31,6 +31,6 @@ public class ProductCategoryUpdateDTO implements Serializable {
     /**
      * 图片
      */
-    List<ProductCategoryPictureDTO> pictures;
+    List<ProductCategoryPictureUpateDTO> pictures;
 
 }

+ 40 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductMarketDataAddNewDTO.java

@@ -0,0 +1,40 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 新增产品营销数据的DTO类
+ */
+@Accessors(chain = true)
+@Data
+public class ProductMarketDataAddNewDTO implements Serializable {
+    /**
+     * 所属产品id
+     */
+    private Integer productId;
+    /**
+     * 营销时间
+     */
+    private String saleTime;
+    /**
+     * 营销地区(国家)
+     */
+    private String saleArea;
+    /**
+     * 销售量
+     */
+    private Integer saleCount;
+    /**
+     * 销售额
+     */
+    private Double saleMoney;
+    /**
+     * 自定义许可费率(默认为产品表的许可费率)
+     */
+    private Double customLicenseRate;
+
+}

+ 18 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductMarketDataQueryPageDTO.java

@@ -0,0 +1,18 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @Author chenyu
+ * @Date 2023/3/9
+ */
+@Accessors(chain = true)
+@Data
+public class ProductMarketDataQueryPageDTO extends PageDTO2 {
+    /**
+     * 所属产品id
+     */
+    private Integer productId;
+
+}

+ 43 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductMarketDataUpdateDTO.java

@@ -0,0 +1,43 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 修改产品营销数据的DTO类
+ */
+@Accessors(chain = true)
+@Data
+public class ProductMarketDataUpdateDTO implements Serializable {
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 所属产品id
+     */
+    private Integer productId;
+    /**
+     * 营销时间
+     */
+    private String saleTime;
+    /**
+     * 营销地区(国家)
+     */
+    private String saleArea;
+    /**
+     * 销售量
+     */
+    private Integer saleCount;
+    /**
+     * 销售额
+     */
+    private Double saleMoney;
+    /**
+     * 自定义许可费率(默认为产品表的许可费率)
+     */
+    private Double customLicenseRate;
+
+}

+ 35 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductPictureUpdateDTO.java

@@ -0,0 +1,35 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 产品的修改图片DTO类
+ */
+@Accessors(chain = true)
+@Data
+public class ProductPictureUpdateDTO implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 产品ID
+     */
+    private Integer productId;
+    /**
+     * 图片名称
+     */
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
+
+}

+ 33 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductQueryPageDTO.java

@@ -0,0 +1,33 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 分页查询产品的DTO类
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@Accessors(chain = true)
+@Data
+public class ProductQueryPageDTO extends PageDTO2 {
+    /**
+     * 模糊查询-产品名称
+     */
+    private String productName;
+    /**
+     * 模糊查询-专利号
+     */
+    private String patentNo;
+    /**
+     * 模糊查询-公司或租户名称
+     */
+    private String companyName;
+
+    /**
+     * 所属产品类别id
+     */
+    private Integer productCategoryId;
+
+}

+ 57 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductUpdateDTO.java

@@ -0,0 +1,57 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品的修改产品DTO类
+ */
+@Data
+@Accessors(chain = true)
+public class ProductUpdateDTO implements Serializable {
+    /**
+     * 产品id
+     */
+    private Integer id;
+    /**
+     * 产品名称
+     */
+    private String productName;
+    /**
+     * 上市时间
+     */
+    private Date marketTime;
+    /**
+     * 所属公司或租户名称
+     */
+    private String companyName;
+    /**
+     * 租户id
+     */
+    private Integer tenantId;
+    /**
+     * 产品说明
+     */
+    private String productExplain;
+    /**
+     * 所属产品类别id
+     */
+    private Integer productCategoryId;
+    /**
+     * 架构id
+     */
+    private Integer structureId;
+    /**
+     * 许可费率
+     */
+    private Double licenseRate;
+    /**
+     * 图片
+     */
+    private List<ProductPictureUpdateDTO> pictures;
+
+}

+ 14 - 2
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductCategoryPictureVO.java

@@ -16,8 +16,20 @@ public class ProductCategoryPictureVO implements Serializable {
      */
     private Integer id;
     /**
-     * 图片路径
+     * 产品类别ID
      */
-    private String picture;
+    private Integer productCategoryId;
+    /**
+     * 图片名称
+     */
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
 
 }

+ 43 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductMarketDataVO.java

@@ -0,0 +1,43 @@
+package cn.cslg.pas.common.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 产品营销数据标准查询VO类
+ */
+@Accessors(chain = true)
+@Data
+public class ProductMarketDataVO implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 所属产品id
+     */
+    private Integer productId;
+    /**
+     * 营销时间
+     */
+    private String saleTime;
+    /**
+     * 营销地区(国家)
+     */
+    private String saleArea;
+    /**
+     * 销售量
+     */
+    private Integer saleCount;
+    /**
+     * 销售额
+     */
+    private Double saleMoney;
+    /**
+     * 自定义许可费率(默认为产品表的许可费率)
+     */
+    private Double customLicenseRate;
+
+}

+ 35 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductPictureVO.java

@@ -0,0 +1,35 @@
+package cn.cslg.pas.common.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 产品的图片标准查询VO类
+ */
+@Accessors(chain = true)
+@Data
+public class ProductPictureVO implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 产品ID
+     */
+    private Integer productId;
+    /**
+     * 图片名称
+     */
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
+
+}

+ 64 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductVO.java

@@ -0,0 +1,64 @@
+package cn.cslg.pas.common.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品的标准查询VO类
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@Accessors(chain = true)
+@Data
+public class ProductVO implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 产品名称
+     */
+    private String productName;
+    /**
+     * 上市时间
+     */
+    private Date marketTime;
+    /**
+     * 所属公司或租户名称
+     */
+    private String companyName;
+    /**
+     * 租户id
+     */
+    private Integer tenantId;
+    /**
+     * 产品说明
+     */
+    private String productExplain;
+    /**
+     * 所属产品类别id
+     */
+    private Integer productCategoryId;
+    /**
+     * 架构id
+     */
+    private Integer structureId;
+    /**
+     * 许可费率
+     */
+    private Double licenseRate;
+    /**
+     * 创建人名称
+     */
+    private String createPersonName;
+    /**
+     * 产品图片
+     */
+    private List<ProductPictureVO> pictures;
+
+}

+ 0 - 3
PAS/src/main/java/cn/cslg/pas/controller/ProductCategoryController.java

@@ -5,12 +5,10 @@ import cn.cslg.pas.common.core.base.Constants;
 import cn.cslg.pas.common.model.dto.ProductCategoryAddNewDTO;
 import cn.cslg.pas.common.model.dto.ProductCategoryQueryPageDTO;
 import cn.cslg.pas.common.model.dto.ProductCategoryUpdateDTO;
-import cn.cslg.pas.common.model.vo.ProductCategoryVO;
 import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.service.IProductCategoryService;
 import com.alibaba.fastjson.JSONObject;
-import com.github.pagehelper.PageInfo;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
@@ -86,5 +84,4 @@ public class ProductCategoryController {
         return Response.success("删除产品类别完成");
     }
 
-
 }

+ 88 - 0
PAS/src/main/java/cn/cslg/pas/controller/ProductController.java

@@ -0,0 +1,88 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.JsonPage;
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.dto.ProductAddNewDTO;
+import cn.cslg.pas.common.model.dto.ProductQueryPageDTO;
+import cn.cslg.pas.common.model.dto.ProductUpdateDTO;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.service.IProductService;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * 产品的Controller层
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@Tag(name = "产品管理模块")
+@Slf4j
+@RequiredArgsConstructor
+@RequestMapping(Constants.API_VERSION_V2 + "/products")
+@RestController
+public class ProductController {
+    private final IProductService productService;
+
+    @Operation(summary = "新增产品")
+    @PostMapping("/addNew")
+    public String addNew(String jsons, List<MultipartFile> files) {
+        if (jsons != null) {
+            ProductAddNewDTO productAddNewDTO = JSONObject.parseObject(jsons, ProductAddNewDTO.class);
+            log.info("开始处理【新增产品】的请求,请求参数为:{}, {}", productAddNewDTO, files);
+            try {
+                productService.addNew(productAddNewDTO, files);
+            } catch (XiaoShiException e) {
+                return Response.error(e.getMessage());
+            }
+            return Response.success("新增产品完成");
+        }
+        return Response.error("请求参数为null");
+    }
+
+    @Operation(summary = "修改产品")
+    @PostMapping("/update")
+    public String update(String jsons, List<MultipartFile> files) {
+        if (jsons != null) {
+            ProductUpdateDTO productUpdateDTO = JSONObject.parseObject(jsons, ProductUpdateDTO.class);
+            log.info("开始处理【修改产品】的请求,请求参数为:{}, {}", productUpdateDTO, files);
+            try {
+                productService.update(productUpdateDTO, files);
+            } catch (XiaoShiException e) {
+                return Response.error(e.getMessage());
+            }
+            return Response.success("修改产品完成");
+        }
+        return Response.error("请求参数为null");
+    }
+
+    @Operation(summary = "分页查询产品")
+    @PostMapping("/query")
+    public String query(@RequestBody ProductQueryPageDTO productQueryPageDTO) {
+        log.info("开始处理【查询产品】的请求,请求参数为:{}", productQueryPageDTO);
+        JsonPage jsonPage = productService.query(productQueryPageDTO);
+        return Response.success(jsonPage);
+    }
+
+    @Operation(summary = "删除产品")
+    @GetMapping("/delete")
+    public String delete(Integer id) {
+        log.info("开始处理【删除产品】的请求,请求参数为:{}", id);
+        try {
+            productService.delete(id);
+        } catch (XiaoShiException e) {
+            return Response.error(e.getMessage());
+        }
+        return Response.success("删除产品完成");
+    }
+
+
+}

+ 75 - 0
PAS/src/main/java/cn/cslg/pas/controller/ProductMarketDataController.java

@@ -0,0 +1,75 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.JsonPage;
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.dto.ProductMarketDataAddNewDTO;
+import cn.cslg.pas.common.model.dto.ProductMarketDataQueryPageDTO;
+import cn.cslg.pas.common.model.dto.ProductMarketDataUpdateDTO;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.service.IProductMarketDataService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 产品营销数据的Controller层
+ *
+ * @Author chenyu
+ * @Date 2023/3/9
+ */
+@Tag(name = "产品营销数据管理模块")
+@RequiredArgsConstructor
+@Slf4j
+@RequestMapping(Constants.API_VERSION_V2 + "/ProductMarketDatas")
+@RestController
+public class ProductMarketDataController {
+    private final IProductMarketDataService productMarketDataService;
+
+    @Operation(summary = "新增产品营销数据")
+    @PostMapping("/addNew")
+    public String addNew(@RequestBody ProductMarketDataAddNewDTO productMarketDataAddNewDTO) {
+        log.info("开始处理【新增产品营销数据】的请求,请求参数为:{}", productMarketDataAddNewDTO);
+        try {
+            productMarketDataService.addNew(productMarketDataAddNewDTO);
+        } catch (XiaoShiException e) {
+            return Response.error(e.getMessage());
+        }
+        return Response.success("新增产品营销数据完成");
+    }
+
+    @Operation(summary = "修改产品营销数据")
+    @PostMapping("/update")
+    public String update(@RequestBody ProductMarketDataUpdateDTO productMarketDataUpdateDTO) {
+        log.info("开始处理【修改产品营销数据】的请求,请求参数为:{}", productMarketDataUpdateDTO);
+        try {
+            productMarketDataService.update(productMarketDataUpdateDTO);
+        } catch (XiaoShiException e) {
+            return Response.error(e.getMessage());
+        }
+        return Response.success("修改产品营销数据完成");
+    }
+
+    @Operation(summary = "分页查询产品营销数据")
+    @PostMapping("/query")
+    public String update(@RequestBody ProductMarketDataQueryPageDTO productMarketDataQueryPageDTO) {
+        log.info("开始处理【分页查询产品营销数据】的请求,请求参数为:{}", productMarketDataQueryPageDTO);
+        JsonPage jsonPage = productMarketDataService.query(productMarketDataQueryPageDTO);
+        return Response.success(jsonPage);
+    }
+
+    @Operation(summary = "删除产品营销数据")
+    @GetMapping("/delete")
+    public String delete(Integer id) {
+        log.info("开始处理【删除产品营销数据】的请求,请求参数为:{}", id);
+        try {
+            productMarketDataService.delete(id);
+        } catch (XiaoShiException e) {
+            return Response.error(e.getMessage());
+        }
+        return Response.success("删除产品营销数据完成");
+    }
+
+}

+ 6 - 2
PAS/src/main/java/cn/cslg/pas/domain/Product.java

@@ -31,7 +31,7 @@ public class Product implements Serializable {
      */
     private Date marketTime;
     /**
-     * 所属公司名称 (或租户)
+     * 所属公司或租户名称
      */
     private String companyName;
     /**
@@ -45,7 +45,7 @@ public class Product implements Serializable {
     /**
      * 所属产品类别id
      */
-    private Integer categoryId;
+    private Integer productCategoryId;
     /**
      * 架构id
      */
@@ -59,6 +59,10 @@ public class Product implements Serializable {
      */
     private Integer createPersonId;
     /**
+     * 创建人名称
+     */
+    private String createPersonName;
+    /**
      * 创建时间
      */
     private Date createTime;

+ 4 - 3
PAS/src/main/java/cn/cslg/pas/domain/ProductMarketData.java

@@ -3,6 +3,7 @@ package cn.cslg.pas.domain;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -19,13 +20,13 @@ public class ProductMarketData implements Serializable {
      */
     private Integer id;
     /**
-     * 产品id
+     * 所属产品id
      */
     private Integer productId;
     /**
      * 营销时间
      */
-    private Date saleTime;
+    private String saleTime;
     /**
      * 营销地区(国家)
      */
@@ -33,7 +34,7 @@ public class ProductMarketData implements Serializable {
     /**
      * 销售量
      */
-    private Double saleCount;
+    private Integer saleCount;
     /**
      * 销售额
      */

+ 10 - 2
PAS/src/main/java/cn/cslg/pas/domain/asso/AssoProductCategoryPicture.java

@@ -22,8 +22,16 @@ public class AssoProductCategoryPicture implements Serializable {
      */
     private Integer productCategoryId;
     /**
-     * 图片路径
+     * 图片名称
      */
-    private String picture;
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
 
 }

+ 10 - 2
PAS/src/main/java/cn/cslg/pas/domain/asso/AssoProductPicture.java

@@ -22,8 +22,16 @@ public class AssoProductPicture implements Serializable {
      */
     private Integer productId;
     /**
-     * 图片路径
+     * 图片名称
      */
-    private String picture;
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
 
 }

+ 2 - 2
PAS/src/main/java/cn/cslg/pas/mapper/AssoProductCategoryPictureMapper.java

@@ -39,7 +39,7 @@ public interface AssoProductCategoryPictureMapper {
     int deleteByProductCategoryId(Integer productCategoryId);
 
     /**
-     * 根据id批量删除数据
+     * 根据id集合批量删除数据
      *
      * @param ids id集合
      * @return 返回受影响的行数
@@ -52,7 +52,7 @@ public interface AssoProductCategoryPictureMapper {
      * @param productCategoryId 产品类别id
      * @return 返回查询到的数据
      */
-    List<ProductCategoryPictureVO> queryListByProductCategoryId(Integer productCategoryId);
+    List<ProductCategoryPictureVO> selectByProductCategoryId(Integer productCategoryId);
 
     /**
      * 根据产品类别id统计数量

+ 49 - 0
PAS/src/main/java/cn/cslg/pas/mapper/AssoProductPictureMapper.java

@@ -0,0 +1,49 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.vo.ProductPictureVO;
+import cn.cslg.pas.domain.asso.AssoProductPicture;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 产品图片关联表的Mapper层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@Repository
+public interface AssoProductPictureMapper {
+    /**
+     * 批量插入数据
+     *
+     * @param assoProductPictures 产品图片数据对象集合
+     * @return 返回受影响的行数
+     */
+    int insertBatch(List<AssoProductPicture> assoProductPictures);
+
+    /**
+     * 根据产品id删除数据
+     *
+     * @param productId 产品id
+     * @return 返回受影响的行数
+     */
+    int deleteByProductId(Integer productId);
+
+    /**
+     * 根据id集合批量删除数据
+     *
+     * @param ids id集合
+     * @return 返回受影响的行数
+     */
+    int deleteByIds(List<Integer> ids);
+
+    /**
+     * 根据产品id查询数据
+     *
+     * @param productId 产品id
+     * @return 返回查询到的数据
+     */
+    List<ProductPictureVO> selectByProductId(Integer productId);
+
+}

+ 81 - 0
PAS/src/main/java/cn/cslg/pas/mapper/ProductMapper.java

@@ -0,0 +1,81 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.dto.ProductQueryPageDTO;
+import cn.cslg.pas.common.model.vo.ProductVO;
+import cn.cslg.pas.domain.Product;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 产品表的Mapper层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@Repository
+public interface ProductMapper {
+    /**
+     * 插入数据
+     *
+     * @param product 产品数据对象
+     * @return 返回受影响的行数
+     */
+    int insert(Product product);
+
+    /**
+     * 根据id删除产品
+     *
+     * @param id 产品id
+     * @return 返回受影响的行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     *
+     * @param productCategoryId
+     * @return
+     */
+    int deleteByProductCategoryId(Integer productCategoryId);
+
+    /**
+     * 根据产品id修改数据
+     *
+     * @param product 产品数据对象
+     * @return 返回受影响的行数
+     */
+    int updateById(Product product);
+
+    /**
+     * 根据产品名称统计数量
+     *
+     * @param productName 产品名称
+     * @return 返回统计到的数量
+     */
+    int countByProductName(String productName);
+
+    /**
+     * 根据id统计数量
+     *
+     * @param id 产品id
+     * @return 返回统计到的数量
+     */
+    int countById(Integer id);
+
+    /**
+     * 根据所属产品类别id统计数量
+     *
+     * @param productCategoryId 所属产品类别id
+     * @return 返回统计到的数量
+     */
+    int countByProductCategoryId(Integer productCategoryId);
+
+    /**
+     * 分页查询数据
+     *
+     * @param productQueryPageDTO 分页信息
+     * @return 返回查询到的数据
+     */
+    List<ProductVO> query(ProductQueryPageDTO productQueryPageDTO);
+
+}

+ 69 - 0
PAS/src/main/java/cn/cslg/pas/mapper/ProductMarketDataMapper.java

@@ -0,0 +1,69 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.dto.ProductMarketDataQueryPageDTO;
+import cn.cslg.pas.common.model.vo.ProductMarketDataVO;
+import cn.cslg.pas.domain.ProductMarketData;
+import org.springframework.stereotype.Repository;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品营销数据表的Mapper层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/9
+ */
+@Repository
+public interface ProductMarketDataMapper {
+    /**
+     * 插入数据
+     *
+     * @param productMarketData 产品营销数据数据对象
+     * @return 返回受影响的行数
+     */
+    int insert(ProductMarketData productMarketData);
+
+    /**
+     * 根据id删除数据
+     *
+     * @param id 产品营销数据id
+     * @return 返回受影响的行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 根据id修改数据
+     *
+     * @param productMarketData 产品营销数据数据对象
+     * @return 返回受影响的行数
+     */
+    int update(ProductMarketData productMarketData);
+
+    /**
+     * 根据所属产品id、营销地区、营销时间统计数量
+     *
+     * @param productId 所属产品id
+     * @param saleArea  营销地区
+     * @param saleTime  营销时间
+     * @return 返回统计到的数量
+     */
+    int countByProductIdSaleAreaSaleTime(Integer productId, String saleArea, String saleTime);
+
+    /**
+     * 根据id统计数量
+     *
+     * @param id 产品营销数据id
+     * @return 返回统计到的数量
+     */
+    int countById(Integer id);
+
+    /**
+     * 分页查询数据
+     *
+     * @param productMarketDataQueryPageDTO 分页信息
+     * @return 返回查询到的数据
+     */
+    List<ProductMarketDataVO> query(ProductMarketDataQueryPageDTO productMarketDataQueryPageDTO);
+
+}

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/service/IProductCategoryService.java

@@ -28,7 +28,7 @@ public interface IProductCategoryService {
     /**
      * 分页查询产品类别
      *
-     * @param productCategoryQueryPageDTO 产品类别分页信息数据对象
+     * @param productCategoryQueryPageDTO 分页信息
      */
     JsonPage query(ProductCategoryQueryPageDTO productCategoryQueryPageDTO);
 

+ 47 - 0
PAS/src/main/java/cn/cslg/pas/service/IProductMarketDataService.java

@@ -0,0 +1,47 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.JsonPage;
+import cn.cslg.pas.common.model.dto.ProductMarketDataAddNewDTO;
+import cn.cslg.pas.common.model.dto.ProductMarketDataQueryPageDTO;
+import cn.cslg.pas.common.model.dto.ProductMarketDataUpdateDTO;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 产品营销数据的Service层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/9
+ */
+public interface IProductMarketDataService {
+    /**
+     * 新增产品营销数据
+     *
+     * @param productMarketDataAddNewDTO 产品营销数据DTO对象
+     */
+    @Transactional
+    void addNew(ProductMarketDataAddNewDTO productMarketDataAddNewDTO);
+
+    /**
+     * 修改产品营销数据
+     *
+     * @param productMarketDataUpdateDTO 产品营销数据DTO对象
+     */
+    @Transactional
+    void update(ProductMarketDataUpdateDTO productMarketDataUpdateDTO);
+
+    /**
+     * 分页查询产品营销数据
+     *
+     * @param productMarketDataQueryPageDTO 分页信息
+     * @return 返回查询到的数据
+     */
+    JsonPage query(ProductMarketDataQueryPageDTO productMarketDataQueryPageDTO);
+
+    /**
+     * 删除产品营销数据
+     *
+     * @param id 产品营销数据id
+     */
+    void delete(Integer id);
+
+}

+ 54 - 0
PAS/src/main/java/cn/cslg/pas/service/IProductService.java

@@ -0,0 +1,54 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.JsonPage;
+import cn.cslg.pas.common.model.dto.ProductAddNewDTO;
+import cn.cslg.pas.common.model.dto.ProductQueryPageDTO;
+import cn.cslg.pas.common.model.dto.ProductUpdateDTO;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * 产品的Service层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+public interface IProductService {
+    /**
+     * 新增产品
+     *
+     * @param productAddNewDTO 新增产品的DTO对象
+     * @param files            产品图片
+     */
+    @Transactional
+    void addNew(ProductAddNewDTO productAddNewDTO, List<MultipartFile> files);
+
+    /**
+     * 修改产品
+     *
+     * @param productUpdateDTO 修改产品的DTO对象
+     * @param files            产品图片
+     */
+    @Transactional
+    void update(ProductUpdateDTO productUpdateDTO, List<MultipartFile> files);
+
+    /**
+     * 分页查询产品
+     *
+     * @param productQueryPageDTO 分页信息
+     * @return 返回查询到的数据
+     */
+    JsonPage query(ProductQueryPageDTO productQueryPageDTO);
+
+    /**
+     * 删除产品
+     *
+     * @param id 产品id
+     */
+    @Transactional
+    void delete(Integer id);
+
+
+}

+ 43 - 32
PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java

@@ -7,13 +7,13 @@ import cn.cslg.pas.common.model.vo.ProductCategoryPictureVO;
 import cn.cslg.pas.common.model.vo.ProductCategoryVO;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.FileUtils;
-import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.pas.domain.ProductCategory;
 import cn.cslg.pas.domain.asso.AssoProductCategoryPicture;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.mapper.AssoProductCategoryPictureMapper;
 import cn.cslg.pas.mapper.ProductCategoryMapper;
+import cn.cslg.pas.mapper.ProductMapper;
 import cn.cslg.pas.service.IProductCategoryService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -38,6 +38,7 @@ import java.util.List;
 public class ProductCategoryServiceImpl implements IProductCategoryService {
     private final ProductCategoryMapper productCategoryMapper;
     private final AssoProductCategoryPictureMapper assoProductCategoryPictureMapper;
+    private final ProductMapper productMapper;
     private final CacheUtils cacheUtils;
     private final LoginUtils loginUtils;
     private final FileUtils fileUtils;
@@ -62,6 +63,14 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             throw new XiaoShiException(message);
         }
 
+        //检查许可费率数值是否合法
+        Double licenseRate = productCategoryAddNewDTO.getLicenseRate();
+        if (licenseRate < 0 || licenseRate > 1) {
+            String message = "新增产品失败,许可费率不合法,请填写正确数值";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
         //新增产品类别DTO对象赋值给产品类别表实体类
         ProductCategory productCategory = new ProductCategory();
         BeanUtils.copyProperties(productCategoryAddNewDTO, productCategory);
@@ -79,17 +88,18 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             throw new XiaoShiException(message);
         }
 
-        //如果有图片,图片文件上传至服务器,后获取url地址,赋值给产品类别图片关联表实体类
-        if (files != null) {
+        //如果有图片,图片文件上传至服务器,后获取图片文件的名称、后缀名、url地址,赋值给产品类别图片关联表实体类
+        if (files != null && files.size() != 0) {
             ArrayList<AssoProductCategoryPicture> assoProductCategoryPictures = new ArrayList<>();
             for (MultipartFile file : files) {
                 //图片文件上传至服务器
                 UploadFileDTO fileDTO = fileUtils.uploadFile(file);
-                //获取图片文件的url地址
-                String picturePath = fileDTO.getPath();
+                //获取并将产品类别id、图片文件的名称、后缀名、url赋值给产品类别图片关联表实体类
                 AssoProductCategoryPicture assoProductCategoryPicture = new AssoProductCategoryPicture()
                         .setProductCategoryId(productCategory.getId())
-                        .setPicture(picturePath);
+                        .setName(fileDTO.getName())
+                        .setSuffix(fileDTO.getExtName())
+                        .setUrl(fileDTO.getPath());
                 assoProductCategoryPictures.add(assoProductCategoryPicture);
             }
 
@@ -115,8 +125,8 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         if (current != null && size != null) {
             PageHelper.startPage(current, size);
         }
-        List<ProductCategoryVO> queryResults = productCategoryMapper.query(productCategoryQueryPageDTO);
-        return JsonPage.restPage(new PageInfo<>(queryResults));
+        List<ProductCategoryVO> ProductCategoryVOs = productCategoryMapper.query(productCategoryQueryPageDTO);
+        return JsonPage.restPage(new PageInfo<>(ProductCategoryVOs));
     }
 
     /**
@@ -151,36 +161,37 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             throw new XiaoShiException(message);
         }
 
-        //先通过产品类别id查询出所有原来的图片文件
+        //先通过产品类别id查询出所有原来的图片文件id
         ArrayList<Integer> oldPictureIds = new ArrayList<>();
-        List<ProductCategoryPictureVO> productCategoryPictureVOS = assoProductCategoryPictureMapper.queryListByProductCategoryId(productCategoryId);
+        List<ProductCategoryPictureVO> productCategoryPictureVOS = assoProductCategoryPictureMapper.selectByProductCategoryId(productCategoryId);
         for (ProductCategoryPictureVO productCategoryPictureVO : productCategoryPictureVOS) {
             Integer oldPictureId = productCategoryPictureVO.getId();
             oldPictureIds.add(oldPictureId);
         }
+        //再从DTO中取出传过来的图片id
         ArrayList<Integer> newOldPictureIds = new ArrayList<>();
-        List<ProductCategoryPictureDTO> productCategoryPictureDTOS = productCategoryUpdateDTO.getPictures();
-        System.out.println(productCategoryPictureDTOS);
-        for (ProductCategoryPictureDTO productCategoryPictureDTO : productCategoryPictureDTOS) {
-            Integer newOldPictureId = productCategoryPictureDTO.getId();
+        List<ProductCategoryPictureUpateDTO> productCategoryPictureUpateDTOS = productCategoryUpdateDTO.getPictures();
+        for (ProductCategoryPictureUpateDTO productCategoryPictureUpateDTO : productCategoryPictureUpateDTOS) {
+            Integer newOldPictureId = productCategoryPictureUpateDTO.getId();
             newOldPictureIds.add(newOldPictureId);
         }
-        //集合去重,去重后留下的数据即为被删除的原有图片
+        //图片id集合去重,保留下来的即被删除的图片id
         oldPictureIds.removeAll(newOldPictureIds);
 
-        if (oldPictureIds.size() != 0) {
-            log.info("产品类别图片关联表删除原有图片");
+        if (oldPictureIds.size() > 0) {
+            log.info("产品类别图片关联表删除被删除的图片");
             assoProductCategoryPictureMapper.deleteByIds(oldPictureIds);
         }
 
-        ArrayList<AssoProductCategoryPicture> assoProductCategoryPictures = new ArrayList<>();
-        if (files != null) {
+        if (files != null && files.size() != 0) {
+            ArrayList<AssoProductCategoryPicture> assoProductCategoryPictures = new ArrayList<>();
             for (MultipartFile file : files) {
                 UploadFileDTO fileDTO = fileUtils.uploadFile(file);
-                String picturePath = fileDTO.getPath();
                 AssoProductCategoryPicture assoProductCategoryPicture = new AssoProductCategoryPicture()
                         .setProductCategoryId(productCategoryId)
-                        .setPicture(picturePath);
+                        .setName(fileDTO.getName())
+                        .setSuffix(fileDTO.getExtName())
+                        .setUrl(fileDTO.getPath());
                 assoProductCategoryPictures.add(assoProductCategoryPicture);
             }
 
@@ -206,20 +217,11 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             throw new XiaoShiException(message);
         }
 
-        //删除产品类别
-        log.info("删除产品类别");
-        int rows = productCategoryMapper.deleteById(id);
-        if (rows != 1) {
-            String message = "删除产品类别失败,服务器忙请稍后再试!";
-            log.info("{}", message);
-            throw new XiaoShiException(message);
-        }
-
         //检查该产品类别是否有图片
         count = assoProductCategoryPictureMapper.countByProductCategoryId(id);
-        if (count != 0) {
+        if (count > 0) {
             log.info("产品类别图片关联表删除数据");
-            rows = assoProductCategoryPictureMapper.deleteByProductCategoryId(id);
+            int rows = assoProductCategoryPictureMapper.deleteByProductCategoryId(id);
             if (rows != count) {
                 String message = "删除产品类别失败,产品类别图片关联表删除数据失败,服务器忙请稍后再试!";
                 log.info("{}", message);
@@ -227,6 +229,15 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
             }
         }
 
+        //删除产品类别
+        log.info("删除产品类别");
+        int rows = productCategoryMapper.deleteById(id);
+        if (rows != 1) {
+            String message = "删除产品类别失败,服务器忙请稍后再试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
         log.info("删除产品类别完成");
 
     }

+ 198 - 0
PAS/src/main/java/cn/cslg/pas/service/impl/ProductMarketDataIServicempl.java

@@ -0,0 +1,198 @@
+package cn.cslg.pas.service.impl;
+
+import cn.cslg.pas.common.JsonPage;
+import cn.cslg.pas.common.model.PersonnelVO;
+import cn.cslg.pas.common.model.dto.ProductMarketDataAddNewDTO;
+import cn.cslg.pas.common.model.dto.ProductMarketDataQueryPageDTO;
+import cn.cslg.pas.common.model.dto.ProductMarketDataUpdateDTO;
+import cn.cslg.pas.common.model.vo.ProductMarketDataVO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.pas.domain.ProductMarketData;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.ProductMarketDataMapper;
+import cn.cslg.pas.service.IProductMarketDataService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 产品营销数据的Service层接口实现类
+ *
+ * @Author chenyu
+ * @Date 2023/3/9
+ */
+@RequiredArgsConstructor
+@Slf4j
+@Service
+public class ProductMarketDataIServicempl implements IProductMarketDataService {
+    private final ProductMarketDataMapper productMarketDataMapper;
+    private final CacheUtils cacheUtils;
+    private final LoginUtils loginUtils;
+
+    /**
+     * 新增产品营销数据
+     *
+     * @param productMarketDataAddNewDTO 产品营销数据DTO对象
+     */
+    @Override
+    public void addNew(ProductMarketDataAddNewDTO productMarketDataAddNewDTO) {
+        log.info("开始处理【新增产品营销数据】的业务,参数为:{}", productMarketDataAddNewDTO);
+
+        //检查该产品在该地区的该月份是否已有营销数据
+        Integer productId = productMarketDataAddNewDTO.getProductId();
+        String saleArea = productMarketDataAddNewDTO.getSaleArea();
+        String saleTime = productMarketDataAddNewDTO.getSaleTime();
+
+        log.info("检查该产品在该地区的该月份是否已有营销数据");
+        int count = productMarketDataMapper.countByProductIdSaleAreaSaleTime(productId, saleArea, saleTime);
+        if (count > 0) {
+            String message = "新增产品营销数据失败,该产品在该地区的该月份已有营销数据!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //新增产品营销数据的DTO对象赋值给实体类
+        ProductMarketData productMarketData = new ProductMarketData();
+        BeanUtils.copyProperties(productMarketDataAddNewDTO, productMarketData);
+
+        //获取当前登录人信息
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        productMarketData
+                .setCreatePersonId(personnelVO.getId())
+                .setCreatePersonName(personnelVO.getName());
+
+        //数据入产品营销数据表
+        log.info("数据入产品营销数据表");
+        int rows = productMarketDataMapper.insert(productMarketData);
+        if (rows != 1) {
+            String message = "新增产品营销数据失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        log.info("新增产品营销数据完成");
+
+    }
+
+    /**
+     * 修改产品营销数据
+     *
+     * @param productMarketDataUpdateDTO 产品营销数据DTO对象
+     */
+    @Override
+    public void update(ProductMarketDataUpdateDTO productMarketDataUpdateDTO) {
+        log.info("开始处理【修改产品营销数据】的业务,参数为:{}", productMarketDataUpdateDTO);
+
+        Integer id = productMarketDataUpdateDTO.getId();
+        Integer productId = productMarketDataUpdateDTO.getProductId();
+        String saleArea = productMarketDataUpdateDTO.getSaleArea();
+        String saleTime = productMarketDataUpdateDTO.getSaleTime();
+
+        //检查尝试修改的数据是否存在
+        log.info("检查尝试修改的数据是否存在");
+        int count = productMarketDataMapper.countById(id);
+        if (count == 0) {
+            String message = "修改产品营销数据失败,尝试访问的数据已不存在";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //DTO对象赋值给实体类
+        ProductMarketData productMarketData = new ProductMarketData();
+        BeanUtils.copyProperties(productMarketDataUpdateDTO, productMarketData);
+
+        //产品营销数据表修改数据
+        log.info("产品营销数据表修改数据");
+        int rows = productMarketDataMapper.update(productMarketData);
+        if (rows != 1) {
+            String message = "修改产品营销数据失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        log.info("修改产品营销数据完成");
+
+    }
+
+    /**
+     * 分页查询产品营销数据
+     *
+     * @param productMarketDataQueryPageDTO 分页信息
+     * @return 返回查询到的数据
+     */
+    @Override
+    public JsonPage query(ProductMarketDataQueryPageDTO productMarketDataQueryPageDTO) {
+        log.info("开始处理【分页查询产品营销数据】的业务,参数为:{}", productMarketDataQueryPageDTO);
+        String orderBy = productMarketDataQueryPageDTO.getOrderBy();
+//        if (orderBy != null) {
+//            char[] cha = orderBy.toCharArray();
+//            String regex = "[A-Z]+";
+//            StringBuffer builder = new StringBuffer();
+//            for (char c : cha) {
+//                if ((c + "").matches(regex)) {
+//                    String _c = "_" + (c + "").toLowerCase();
+//                    builder.append(_c);
+//                    continue;
+//                }
+//                String _c = String.valueOf(c);
+//                builder.append(c);
+//            }
+//        }
+        if (orderBy != null) {
+            String regex = "[A-Z]+";
+            Pattern pattern = Pattern.compile(regex);
+            Matcher matcher = pattern.matcher(orderBy);
+            while (matcher.find()) {
+                orderBy = orderBy.replaceFirst(matcher.group(), "_" + matcher.group().toLowerCase());
+            }
+            productMarketDataQueryPageDTO.setOrderBy(orderBy);
+        }
+        Integer current = productMarketDataQueryPageDTO.getCurrent();
+        Integer size = productMarketDataQueryPageDTO.getSize();
+        if (current != null && size != null) {
+            PageHelper.startPage(current, size);
+        }
+        List<ProductMarketDataVO> queryResults = productMarketDataMapper.query(productMarketDataQueryPageDTO);
+        return JsonPage.restPage(new PageInfo<>(queryResults));
+    }
+
+    /**
+     * 删除产品营销数据
+     *
+     * @param id 产品营销数据id
+     */
+    @Override
+    public void delete(Integer id) {
+        log.info("开始处理【删除产品营销数据】的业务,参数为:{}", id);
+
+        //检查尝试删除的数据是否存在
+        log.info("检查尝试删除的数据是否存在");
+        int count = productMarketDataMapper.countById(id);
+        if (count == 0) {
+            String message = "删除产品营销数据失败,尝试访问的数据已不存在";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //产品营销数据表删除数据
+        log.info("产品营销数据表删除数据");
+        int rows = productMarketDataMapper.deleteById(id);
+        if (rows != 1) {
+            String message = "删除产品营销数据失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        log.info("删除产品营销数据完成");
+
+    }
+
+}

+ 235 - 0
PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java

@@ -0,0 +1,235 @@
+package cn.cslg.pas.service.impl;
+
+import cn.cslg.pas.common.JsonPage;
+import cn.cslg.pas.common.model.PersonnelVO;
+import cn.cslg.pas.common.model.dto.*;
+import cn.cslg.pas.common.model.vo.ProductPictureVO;
+import cn.cslg.pas.common.model.vo.ProductVO;
+import cn.cslg.pas.common.utils.CacheUtils;
+import cn.cslg.pas.common.utils.FileUtils;
+import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.pas.domain.Product;
+import cn.cslg.pas.domain.asso.AssoProductPicture;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.AssoProductPictureMapper;
+import cn.cslg.pas.mapper.ProductMapper;
+import cn.cslg.pas.service.IProductService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 产品的Service层接口实现类
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@RequiredArgsConstructor
+@Slf4j
+@Service
+public class ProductServiceImpl implements IProductService {
+    private final ProductMapper productMapper;
+    private final AssoProductPictureMapper assoProductPictureMapper;
+    private final CacheUtils cacheUtils;
+    private final LoginUtils loginUtils;
+    private final FileUtils fileUtils;
+
+    /**
+     * 新增产品
+     *
+     * @param productAddNewDTO 新增产品的DTO对象
+     * @param files            产品图片
+     */
+    @Override
+    public void addNew(ProductAddNewDTO productAddNewDTO, List<MultipartFile> files) {
+        log.info("开始处理【新增产品】的业务,参数为:{}, {}", productAddNewDTO, files);
+
+        //检查产品名称是否被占用
+        String productName = productAddNewDTO.getProductName();
+        log.info("检查产品名称是否被占用");
+        int count = productMapper.countByProductName(productName);
+        if (count > 0) {
+            String message = "新增产品失败,产品名称【" + productName + "】已存在,请尝试更换名称";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        Double licenseRate = productAddNewDTO.getLicenseRate();
+        if (licenseRate < 0 || licenseRate > 1) {
+            String message = "新增产品失败,许可费率不合法,请填写正确数值";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //产品新增DTO对象赋值给实体类
+        Product product = new Product();
+        BeanUtils.copyProperties(productAddNewDTO, product);
+        //获取当前登陆人信息并赋值给实体类
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        product
+                .setCreatePersonId(personnelVO.getId())
+                .setCreatePersonName(personnelVO.getName());
+        //数据入产品表
+        log.info("数据入产品表");
+        int rows = productMapper.insert(product);
+        if (rows != 1) {
+            String message = "新增产品失败,服务器忙请稍后再试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //如果有图片,图片文件上传至服务器,后获取图片文件的名称、后缀名、url地址,赋值给产品类别图片关联表实体类
+        if (files != null && files.size() != 0) {
+            ArrayList<AssoProductPicture> assoProductPictures = new ArrayList<>();
+            for (MultipartFile file : files) {
+                UploadFileDTO fileDTO = fileUtils.uploadFile(file);
+                //获取并将产品id、图片文件的名称、后缀名、url赋值给产品图片关联表实体类
+                AssoProductPicture assoProductPicture = new AssoProductPicture()
+                        .setProductId(product.getId())
+                        .setName(fileDTO.getName())
+                        .setSuffix(fileDTO.getExtName())
+                        .setUrl(fileDTO.getPath());
+                assoProductPictures.add(assoProductPicture);
+            }
+
+            log.info("数据入产品图片关联表");
+            rows = assoProductPictureMapper.insertBatch(assoProductPictures);
+            if (rows != assoProductPictures.size()) {
+                String message = "新增产品失败,数据入产品图片关联表失败,服务器忙请稍后再试!";
+                log.info("{}", message);
+                throw new XiaoShiException(message);
+            }
+        }
+
+        log.info("新增产品完成");
+
+    }
+
+    /**
+     * 修改产品
+     *
+     * @param productUpdateDTO 修改产品的DTO对象
+     * @param files            产品图片
+     */
+    @Override
+    public void update(ProductUpdateDTO productUpdateDTO, List<MultipartFile> files) {
+        log.info("开始处理【修改产品】的业务,参数为:{}, {}", productUpdateDTO, files);
+
+        //检查尝试修改的数据是否存在
+        Integer productId = productUpdateDTO.getId();
+        log.info("检查尝试修改的数据是否存在");
+        int count = productMapper.countById(productId);
+        if (count == 0) {
+            String message = "修改产品失败,尝试访问的数据已不存在";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //产品DTO对象赋值给实体类
+        Product product = new Product();
+        BeanUtils.copyProperties(productUpdateDTO, product);
+        //修改产品
+        log.info("修改产品");
+        int rows = productMapper.updateById(product);
+        if (rows != 1) {
+            String message = "修改产品失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //先通过产品id查询出所有原来的图片文件id
+        List<ProductPictureVO> productPictureVOs = assoProductPictureMapper.selectByProductId(productId);
+        ArrayList<Integer> oldPictureIds = new ArrayList<>();
+        for (ProductPictureVO productPictureVO : productPictureVOs) {
+            Integer pictureId = productPictureVO.getId();
+            oldPictureIds.add(pictureId);
+        }
+
+        //再从DTO中取出传过来的图片id
+        List<ProductPictureUpdateDTO> pictures = productUpdateDTO.getPictures();
+        ArrayList<Integer> oldNewPictureIds = new ArrayList<>();
+        for (ProductPictureUpdateDTO picture : pictures) {
+            Integer oldNewPictureId = picture.getId();
+            oldNewPictureIds.add(oldNewPictureId);
+        }
+
+        //图片id集合去重,保留下来的即被删除的图片id
+        oldPictureIds.removeAll(oldNewPictureIds);
+        if (oldPictureIds.size() > 0) {
+            log.info("产品图片关联表删除被删除的图片");
+            assoProductPictureMapper.deleteByIds(oldPictureIds);
+        }
+
+        if (files != null && files.size() != 0) {
+            ArrayList<AssoProductPicture> assoProductPictures = new ArrayList<>();
+            for (MultipartFile file : files) {
+                UploadFileDTO fileDTO = fileUtils.uploadFile(file);
+                AssoProductPicture assoProductPicture = new AssoProductPicture()
+                        .setProductId(productId)
+                        .setName(fileDTO.getName())
+                        .setSuffix(fileDTO.getExtName())
+                        .setUrl(fileDTO.getPath());
+                assoProductPictures.add(assoProductPicture);
+            }
+
+            //新数据入产品类别图片关联表
+            log.info("新数据入产品类别图片关联表");
+            assoProductPictureMapper.insertBatch(assoProductPictures);
+
+        }
+
+        log.info("修改产品完成");
+
+    }
+
+    @Override
+    public JsonPage query(ProductQueryPageDTO productQueryPageDTO) {
+        log.info("开始处理【查询产品】的业务,参数为:{}", productQueryPageDTO);
+
+        Integer current = productQueryPageDTO.getCurrent();
+        Integer size = productQueryPageDTO.getSize();
+        if (current != null && size != null) {
+            PageHelper.startPage(current, size);
+        }
+        List<ProductVO> productVOs = productMapper.query(productQueryPageDTO);
+        return JsonPage.restPage(new PageInfo<>(productVOs));
+    }
+
+    @Override
+    public void delete(Integer id) {
+        log.info("开始处理【删除产品】的业务,参数为:{}", id);
+
+        //检查尝试访问的数据是否存在
+        int count = productMapper.countById(id);
+        if (count == 0) {
+            String message = "删除产品失败,尝试访问的数据已不存在";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //删除产品图片数据
+        log.info("产品图片关联表删除数据");
+        assoProductPictureMapper.deleteByProductId(id);
+
+        //删除产品数据
+        log.info("产品表删除数据");
+        int rows = productMapper.deleteById(id);
+        if (rows != 1) {
+            String message = "删除产品失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        log.info("删除产品完成");
+
+    }
+
+
+}

+ 8 - 8
PAS/src/main/resources/mapper/AssoProductCategoryPictureMapper.xml

@@ -5,17 +5,17 @@
     <!--插入数据-->
     <!--int insert(AssoProductCategoryPicture assoProductCategoryPicture);-->
     <insert id="insert" useGeneratedKeys="true" keyProperty="id">
-        insert into asso_product_category_picture (product_category_id, picture)
-        values (#{productCategoryId}, #{picture})
+        insert into asso_product_category_picture (product_category_id, name, suffix, url)
+        values (#{productCategoryId}, #{name}, #{suffix}, #{url})
     </insert>
 
     <!--批量插入数据-->
     <!--int insertBatch(List<AssoProductCategoryPicture> assoProductCategoryPictures);-->
     <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
-        insert into asso_product_category_picture (product_category_id, picture)
+        insert into asso_product_category_picture (product_category_id, name, suffix, url)
         values
         <foreach collection="list" item="n" separator=",">
-            (#{n.productCategoryId}, #{n.picture})
+            (#{n.productCategoryId}, #{n.name}, #{n.suffix}, #{n.url})
         </foreach>
     </insert>
 
@@ -27,7 +27,7 @@
         where product_category_id = #{productCategoryId}
     </delete>
 
-    <!--根据id批量删除数据-->
+    <!--根据id集合批量删除数据-->
     <!--int deleteByIds(List<Integer> ids);-->
     <delete id="deleteByIds">
         delete
@@ -40,9 +40,9 @@
     </delete>
 
     <!--根据产品类别id查询数据-->
-    <!--List<ProductCategoryPictureVO> queryListByProductCategoryId(Integer productCategoryId);-->
-    <select id="queryListByProductCategoryId" resultMap="getStandardByProductCategoryIdMap">
-        select id, picture
+    <!--List<ProductCategoryPictureVO> selectByProductCategoryId(Integer productCategoryId);-->
+    <select id="selectByProductCategoryId" resultMap="getStandardByProductCategoryIdMap">
+        select id, product_category_id, name, suffix, url
         from asso_product_category_picture
         where product_category_id = #{productCategoryId}
     </select>

+ 7 - 3
PAS/src/main/resources/mapper/ProductCategoryMapper.xml

@@ -26,7 +26,7 @@
                 product_category_name = #{productCategoryName},
             </if>
             <if test="remark != null">
-                remark = #{productCategoryName},
+                remark = #{remark},
             </if>
             <if test="licenseRate != null">
                 license_rate = #{licenseRate},
@@ -66,7 +66,11 @@
                 and product_category_name like '%${productCategoryName}%'
             </if>
             <if test="createPersonName != null">
-                and create_person_name like '%${createPersonName}%'
+                and create_person_id in (select id from pcs_test.personnel where personnel_name like
+                '%${createPersonName}%')
+            </if>
+            <if test="productName != null">
+                and id in (select product_category_id from product where product_name like '%${productName}%')
             </if>
         </where>
         order by pc_id
@@ -84,7 +88,7 @@
     </resultMap>
 
     <select id="query2" resultMap="queryMap2">
-        select id, picture
+        select id, product_category_id, name, suffix, url
         from asso_product_category_picture
         where product_category_id = #{pc_id}
     </select>

+ 140 - 0
PAS/src/main/resources/mapper/ProductMapper.xml

@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="cn.cslg.pas.mapper.ProductMapper">
+    <!--插入数据-->
+    <!--int insert(Product product);-->
+    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
+        insert into product (product_name, market_time, company_name, tenant_id, product_explain,
+                             product_category_id, structure_id, license_rate, create_person_id, create_person_name)
+        values (#{productName}, #{marketTime}, #{companyName}, #{tenantId}, #{productExplain}, #{productCategoryId},
+                #{structureId}, #{licenseRate}, #{createPersonId}, #{createPersonName});
+    </insert>
+
+    <!--根据id删除产品-->
+    <!--int deleteById(Integer id);-->
+    <delete id="deleteById">
+        delete
+        from product
+        where id = #{id}
+    </delete>
+
+    <!--根据产品id修改数据-->
+    <!--int updateById(Product product);-->
+    <update id="updateById">
+        update product
+        <set>
+            <if test="productName != null">
+                product_name = #{productName},
+            </if>
+            <if test="marketTime != null">
+                market_time = #{marketTime},
+            </if>
+            <if test="companyName != null">
+                company_name = #{companyName},
+            </if>
+            <if test="tenantId != null">
+                tenant_id = #{tenantId},
+            </if>
+            <if test="productExplain != null">
+                product_explain = #{productExplain},
+            </if>
+            <if test="productCategoryId != null">
+                product_category_id = #{productCategoryId},
+            </if>
+            <if test="structureId != null">
+                structure_id = #{structureId},
+            </if>
+            <if test="licenseRate != null">
+                license_rate = #{licenseRate},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--根据产品名称统计数量-->
+    <!--int countByProductName(String productName);-->
+    <select id="countByProductName" resultType="int">
+        select count(*)
+        from product
+        where product_name = #{productName}
+    </select>
+
+    <!--根据id统计数量-->
+    <!--int countById(Integer id);-->
+    <select id="countById" resultType="int">
+        select count(*)
+        from product
+        where id = #{id}
+    </select>
+
+    <!--根据所属产品类别id统计数量-->
+    <!--int countByProductCategoryId(Integer productCategoryId);-->
+    <select id="countByProductCategoryId" resultType="int">
+        select count(*)
+        from product
+        where product_category_id = #{productCategoryId}
+    </select>
+
+    <!--分页查询数据-->
+    <!--List<ProductVO> query(ProductQueryPageDTO productQueryPageDTO);-->
+    <select id="query" resultMap="queryMap">
+        select id p_id,
+        product_name,
+        market_time,
+        company_name,
+        tenant_id,
+        product_explain,
+        product_category_id,
+        structure_id,
+        license_rate,
+        create_person_name
+        from product
+        <where>
+            <if test="productName != null">
+                and product_name like '%${productName}%'
+            </if>
+            <if test="companyName != null">
+                and company_name like '%${companyName}%'
+            </if>
+            <if test="patentNo != null">
+                and id in (select product_id from asso_product_patent where patent_no like '%${patentNo}%')
+            </if>
+            <if test="productCategoryId != null">
+                and product_category_id = #{productCategoryId}
+            </if>
+        </where>
+        order by p_id
+    </select>
+
+    <resultMap id="queryMap" type="cn.cslg.pas.common.model.vo.ProductVO">
+        <id column="p_id" property="id"/>
+        <result column="product_name" property="productName"/>
+        <result column="market_time" property="marketTime"/>
+        <result column="company_name" property="companyName"/>
+        <result column="tenant_id" property="tenantId"/>
+        <result column="product_explain" property="productExplain"/>
+        <result column="product_category_id" property="productCategoryId"/>
+        <result column="structure_id" property="structureId"/>
+        <result column="license_rate" property="licenseRate"/>
+        <result column="create_person_name" property="createPersonName"/>
+        <collection property="pictures" ofType="cn.cslg.pas.common.model.vo.ProductPictureVO"
+                    select="query2" column="p_id">
+        </collection>
+    </resultMap>
+
+    <select id="query2" resultMap="query2Map">
+        select id, product_id, name, suffix, url
+        from asso_product_picture
+        where product_id = #{p_id}
+    </select>
+
+    <resultMap id="query2Map" type="cn.cslg.pas.common.model.vo.ProductPictureVO">
+        <id column="id" property="id"/>
+        <result column="product_id" property="productId"/>
+        <result column="name" property="name"/>
+        <result column="suffix" property="suffix"/>
+        <result column="url" property="url"/>
+    </resultMap>
+
+</mapper>

+ 112 - 0
PAS/src/main/resources/mapper/ProductMarketDataMapper.xml

@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="cn.cslg.pas.mapper.ProductMarketDataMapper">
+    <!--插入数据-->
+    <!--int insert(ProductMarketData productMarketData);-->
+    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
+        insert into product_market_data (product_id, sale_time, sale_area, sale_count, sale_money,
+                                         custom_license_rate, create_person_id, create_person_name)
+        values (#{productId}, #{saleTime}, #{saleArea}, #{saleCount}, #{saleMoney}, #{customLicenseRate},
+                #{createPersonId}, #{createPersonName});
+    </insert>
+
+    <!--根据id删除数据-->
+    <!--int deleteById(Integer id);-->
+    <delete id="deleteById">
+        delete
+        from product_market_data
+        where id = #{id}
+    </delete>
+
+    <!--根据id修改数据-->
+    <!--int update(ProductMarketData productMarketData);-->
+    <update id="update">
+        update product_market_data
+        <set>
+            <if test="productId != null">
+                product_id = #{productId},
+            </if>
+            <if test="saleTime != null">
+                sale_time = #{saleTime},
+            </if>
+            <if test="saleArea != null">
+                sale_area = #{saleArea},
+            </if>
+            <if test="saleCount != null">
+                sale_count = #{saleCount},
+            </if>
+            <if test="saleMoney != null">
+                sale_money = #{saleMoney},
+            </if>
+            <if test="customLicenseRate != null">
+                custom_license_rate = #{customLicenseRate},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--根据所属产品id、营销地区、营销时间统计数量-->
+    <!--int countByProductIdSaleAreaSaleTime(Integer productId, String saleArea, Date saleTime);-->
+    <select id="countByProductIdSaleAreaSaleTime" resultType="int">
+        select count(*)
+        from product_market_data
+        <where>
+            <if test="productId != null">
+                and product_id = #{productId}
+            </if>
+            <if test="saleArea != null">
+                and sale_area = #{saleArea}
+            </if>
+            <if test="saleTime != null">
+                and sale_time = #{saleTime}
+            </if>
+        </where>
+    </select>
+
+    <!--根据id统计数量-->
+    <!--int countById(Integer id);-->
+    <select id="countById" resultType="int">
+        select count(*)
+        from product_market_data
+        where id = #{id}
+    </select>
+
+    <!--分页查询数据-->
+    <!--List<ProductMarketDataVO> query(ProductMarketDataQueryPageDTO productMarketDataQueryPageDTO);-->
+    <select id="query" resultMap="queryMap">
+        select id,
+        product_id,
+        sale_time,
+        sale_area,
+        sale_count,
+        sale_money,
+        custom_license_rate
+        from product_market_data
+        <where>
+            <if test="productId != null">
+                product_id = #{productId}
+            </if>
+        </where>
+        order by
+        <choose>
+            <when test="orderBy != null and orderType != null">
+                ${orderBy} ${orderType}
+            </when>
+            <otherwise>
+                id desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <resultMap id="queryMap" type="cn.cslg.pas.common.model.vo.ProductMarketDataVO">
+        <id column="id" property="id"/>
+        <result column="product_id" property="productId"/>
+        <result column="sale_time" property="saleTime"/>
+        <result column="sale_area" property="saleArea"/>
+        <result column="sale_count" property="saleCount"/>
+        <result column="sale_money" property="saleMoney"/>
+        <result column="custom_license_rate" property="customLicenseRate"/>
+    </resultMap>
+
+</mapper>

+ 55 - 0
PAS/src/main/resources/mapper/ProductPictureMapper.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="cn.cslg.pas.mapper.AssoProductPictureMapper">
+    <!--批量插入数据-->
+    <!--int insertBatch(List<AssoProductPicture> assoProductPictures);-->
+    <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
+        insert into asso_product_picture (product_id, name, suffix, url)
+        values
+        <foreach collection="list" item="n" separator=",">
+            (#{n.productId}, #{n.name}, #{n.suffix}, #{n.url})
+        </foreach>
+    </insert>
+
+    <!--根据产品id删除数据-->
+    <!--int deleteByProductId(Integer productId);-->
+    <delete id="deleteByProductId">
+        delete
+        from asso_product_picture
+        where product_id = #{productId}
+    </delete>
+
+    <!--根据id集合批量删除数据-->
+    <!--int deleteByIds(List<Integer> ids);-->
+    <delete id="deleteByIds">
+        delete
+        from asso_product_picture
+        where id in (
+        <foreach collection="list" item="n" separator=",">
+            #{n}
+        </foreach>
+        )
+    </delete>
+
+    <!--根据产品id查询数据-->
+    <!--List<ProductPictureVO> selectByProductId(Integer productId);-->
+    <select id="selectByProductId" resultMap="selectByProductIdMap">
+        select id,
+               product_id,
+               name,
+               suffix,
+               url
+        from asso_product_picture
+        where product_id = #{productId}
+    </select>
+
+    <resultMap id="selectByProductIdMap" type="cn.cslg.pas.common.model.vo.ProductPictureVO">
+        <id column="id" property="id"/>
+        <result column="product_id" property="productId"/>
+        <result column="name" property="name"/>
+        <result column="suffix" property="suffix"/>
+        <result column="url" property="url"/>
+    </resultMap>
+
+</mapper>