chendayu 2 년 전
부모
커밋
2680e8dbe1
29개의 변경된 파일1251개의 추가작업 그리고 81개의 파일을 삭제
  1. 0 4
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductAddNewDTO.java
  2. 0 4
      PAS/src/main/java/cn/cslg/pas/common/model/dto/ProductUpdateDTO.java
  3. 35 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/StructureAddNewDTO.java
  4. 28 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/StructureQueryPageDTO.java
  5. 10 13
      PAS/src/main/java/cn/cslg/pas/domain/Element.java
  6. 38 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/StructurePictureVO.java
  7. 48 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/StructureVO.java
  8. 50 0
      PAS/src/main/java/cn/cslg/pas/controller/StructureController.java
  9. 0 4
      PAS/src/main/java/cn/cslg/pas/domain/Product.java
  10. 13 10
      PAS/src/main/java/cn/cslg/pas/domain/Structure.java
  11. 0 29
      PAS/src/main/java/cn/cslg/pas/domain/asso/AssoElementPicture.java
  12. 5 5
      PAS/src/main/java/cn/cslg/pas/domain/asso/AssoElementPatent.java
  13. 5 5
      PAS/src/main/java/cn/cslg/pas/domain/asso/AssoElementProduct.java
  14. 37 0
      PAS/src/main/java/cn/cslg/pas/domain/asso/AssoStructurePicture.java
  15. 24 0
      PAS/src/main/java/cn/cslg/pas/mapper/AssoStructurePictureMapper.java
  16. 66 0
      PAS/src/main/java/cn/cslg/pas/mapper/StructureMapper.java
  17. 47 0
      PAS/src/main/java/cn/cslg/pas/service/IStructureService.java
  18. 173 0
      PAS/src/main/java/cn/cslg/pas/service/impl/StructureServiceImpl.java
  19. 0 0
      PAS/src/main/resources/mapper/AssoProductPictureMapper.xml
  20. 15 0
      PAS/src/main/resources/mapper/AssoStructurePictureMapper.xml
  21. 2 7
      PAS/src/main/resources/mapper/ProductMapper.xml
  22. 113 0
      PAS/src/main/resources/mapper/StructureMapper.xml
  23. 85 0
      PAS/src/test/java/cn/cslg/pas/mapper/AssoProductCategoryPictureMapperTests.java
  24. 71 0
      PAS/src/test/java/cn/cslg/pas/mapper/AssoProductPictureMapperTests.java
  25. 44 0
      PAS/src/test/java/cn/cslg/pas/mapper/AssoStructurePictureMapperTests.java
  26. 80 0
      PAS/src/test/java/cn/cslg/pas/mapper/ProductCategoryMapperTests.java
  27. 97 0
      PAS/src/test/java/cn/cslg/pas/mapper/ProductMapperTests.java
  28. 89 0
      PAS/src/test/java/cn/cslg/pas/mapper/ProductMarketDataMapperTests.java
  29. 76 0
      PAS/src/test/java/cn/cslg/pas/mapper/StructureMapperTests.java

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

@@ -37,10 +37,6 @@ public class ProductAddNewDTO implements Serializable {
      */
     private Integer productCategoryId;
     /**
-     * 架构id
-     */
-    private Integer structureId;
-    /**
      * 许可费率
      */
     private Double licenseRate;

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

@@ -42,10 +42,6 @@ public class ProductUpdateDTO implements Serializable {
      */
     private Integer productCategoryId;
     /**
-     * 架构id
-     */
-    private Integer structureId;
-    /**
      * 许可费率
      */
     private Double licenseRate;

+ 35 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/StructureAddNewDTO.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 StructureAddNewDTO implements Serializable {
+    /**
+     * 父级id
+     */
+    private Integer parentId;
+    /**
+     * 名称
+     */
+    private String structureName;
+    /**
+     * 路径
+     */
+    private String parentPath;
+    /**
+     * 说明
+     */
+    private String remark;
+    /**
+     * 产品id
+     */
+    private Integer productId;
+
+}

+ 28 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/StructureQueryPageDTO.java

@@ -0,0 +1,28 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * 架构分页查询DTO类
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+@Accessors(chain = true)
+@Data
+public class StructureQueryPageDTO {
+    /**
+     * 产品id
+     */
+    private Integer productId;
+    /**
+     * 架构id
+     */
+    private Integer structureId;
+    /**
+     * 架构名称
+     */
+    private String structureName;
+
+}

+ 10 - 13
PAS/src/main/java/cn/cslg/pas/domain/Element.java

@@ -1,7 +1,6 @@
-package cn.cslg.pas.domain;
+package cn.cslg.pas.common.model.dto;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -14,32 +13,30 @@ import java.io.Serializable;
  */
 @Accessors(chain = true)
 @Data
-@TableName(value = "element")
-public class Element implements Serializable {
+public class StructureUpdateDTO implements Serializable {
     /**
      * ID
      */
-    @TableId(type = IdType.AUTO)
     private Integer id;
     /**
-     * 架构id
-     */
-    private Integer structureId;
-    /**
      * 父级id
      */
     private Integer parentId;
     /**
-     * 元素名称
+     * 名称
      */
-    private Integer elementName;
+    private String structureName;
     /**
-     * 元素路径
+     * 路径
      */
     private String path;
     /**
-     * 元素说明
+     * 说明
      */
     private String remark;
+    /**
+     * 产品id
+     */
+    private Integer productId;
 
 }

+ 38 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/StructurePictureVO.java

@@ -0,0 +1,38 @@
+package cn.cslg.pas.common.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 架构图片标准查询VO类
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+@Accessors(chain = true)
+@Data
+public class StructurePictureVO implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 架构id
+     */
+    private Integer structureId;
+    /**
+     * 图片名称
+     */
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
+
+}

+ 48 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/StructureVO.java

@@ -0,0 +1,48 @@
+package cn.cslg.pas.common.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 元素表实体类
+ */
+@Accessors(chain = true)
+@Data
+public class StructureVO implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 父级id
+     */
+    private Integer parentId;
+    /**
+     * 名称
+     */
+    private String structureName;
+    /**
+     * 路径
+     */
+    private String path;
+    /**
+     * 说明
+     */
+    private String remark;
+    /**
+     * 产品id
+     */
+    private Integer productId;
+    /**
+     * 图片
+     */
+    private List<StructurePictureVO> pictures;
+    /**
+     * 子架构集合
+     */
+    private List<StructureVO> children;
+
+}

+ 50 - 0
PAS/src/main/java/cn/cslg/pas/controller/StructureController.java

@@ -0,0 +1,50 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.dto.StructureAddNewDTO;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.service.IStructureService;
+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.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * 架构的Controller层
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+@Tag(name = "架构管理模块")
+@RequiredArgsConstructor
+@Slf4j
+@RequestMapping(Constants.API_VERSION_V2 + "/structures")
+@RestController
+public class StructureController {
+    private final IStructureService structureService;
+
+    @Operation(summary = "新增架构")
+    @PostMapping("/addNew")
+    public String addNew(String jsons, List<MultipartFile> files) {
+        if (jsons != null) {
+            StructureAddNewDTO structureAddNewDTO = JSONObject.parseObject(jsons, StructureAddNewDTO.class);
+            log.info("开始处理【新增架构】的请求,请求参数为:{}, {}", structureAddNewDTO, files);
+            try {
+                structureService.addNew(structureAddNewDTO, files);
+            } catch (XiaoShiException e) {
+                return Response.error(e.getMessage());
+            }
+            return Response.success("新增架构完成");
+        }
+        return Response.error("请求参数为null");
+    }
+
+}

+ 0 - 4
PAS/src/main/java/cn/cslg/pas/domain/Product.java

@@ -47,10 +47,6 @@ public class Product implements Serializable {
      */
     private Integer productCategoryId;
     /**
-     * 架构id
-     */
-    private Integer structureId;
-    /**
      * 许可费率
      */
     private Double licenseRate;

+ 13 - 10
PAS/src/main/java/cn/cslg/pas/domain/Structure.java

@@ -8,10 +8,9 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
-import java.util.Date;
 
 /**
- * 架构表实体类
+ * 元素表实体类
  */
 @Accessors(chain = true)
 @Data
@@ -23,20 +22,24 @@ public class Structure implements Serializable {
     @TableId(type = IdType.AUTO)
     private Integer id;
     /**
-     * 创建人ID
+     * 父级id
      */
-    private Integer createPersonId;
+    private Integer parentId;
     /**
-     * 创建人名称
+     * 名称
      */
-    private String createPersonName;
+    private String structureName;
     /**
-     * 创建时间
+     * 路径
      */
-    private Date createTime;
+    private String path;
     /**
-     * 最后修改时间
+     * 说明
      */
-    private Date modifiedTime;
+    private String remark;
+    /**
+     * 产品id
+     */
+    private Integer productId;
 
 }

+ 0 - 29
PAS/src/main/java/cn/cslg/pas/domain/asso/AssoElementPicture.java

@@ -1,29 +0,0 @@
-package cn.cslg.pas.domain.asso;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * 元素图片关联表实体类
- */
-@Accessors(chain = true)
-@Data
-@TableName(value = "asso_element_picture")
-public class AssoElementPicture implements Serializable {
-    /**
-     * ID
-     */
-    private Integer id;
-    /**
-     * 元素id
-     */
-    private Integer elementId;
-    /**
-     * 图片路径
-     */
-    private String picture;
-
-}

+ 5 - 5
PAS/src/main/java/cn/cslg/pas/domain/asso/AssoElementPatent.java

@@ -7,20 +7,20 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 架构元素专利关联表实体类
+ * 专利架构关联表实体类
  */
 @Accessors(chain = true)
 @Data
-@TableName(value = "asso_element_patent")
-public class AssoElementPatent implements Serializable {
+@TableName(value = "asso_structure_patent")
+public class AssoPatentStructure implements Serializable {
     /**
      * ID
      */
     private Integer id;
     /**
-     * 元素id
+     * 架构id
      */
-    private Integer elementId;
+    private Integer structureId;
     /**
      * 专利号
      */

+ 5 - 5
PAS/src/main/java/cn/cslg/pas/domain/asso/AssoElementProduct.java

@@ -7,12 +7,12 @@ import lombok.experimental.Accessors;
 import java.io.Serializable;
 
 /**
- * 元素产品关联表实体类
+ * 产品架构关联表实体类
  */
 @Accessors(chain = true)
 @Data
-@TableName(value = "asso_element_product")
-public class AssoElementProduct implements Serializable {
+@TableName(value = "asso_structure_product")
+public class AssoProductStructure implements Serializable {
     /**
      * 主键ID
      */
@@ -22,8 +22,8 @@ public class AssoElementProduct implements Serializable {
      */
     private Integer productId;
     /**
-     * 元素id
+     * 架构id
      */
-    private Integer elementId;
+    private Integer structureId;
 
 }

+ 37 - 0
PAS/src/main/java/cn/cslg/pas/domain/asso/AssoStructurePicture.java

@@ -0,0 +1,37 @@
+package cn.cslg.pas.domain.asso;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 架构图片关联表实体类
+ */
+@Accessors(chain = true)
+@Data
+@TableName(value = "asso_structure_picture")
+public class AssoStructurePicture implements Serializable {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 架构id
+     */
+    private Integer structureId;
+    /**
+     * 图片名称
+     */
+    private String name;
+    /**
+     * 后缀类型
+     */
+    private String suffix;
+    /**
+     * 路径
+     */
+    private String url;
+
+}

+ 24 - 0
PAS/src/main/java/cn/cslg/pas/mapper/AssoStructurePictureMapper.java

@@ -0,0 +1,24 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.asso.AssoStructurePicture;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 架构图片关联表的Mapper层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+@Repository
+public interface AssoStructurePictureMapper {
+    /**
+     * 批量插入数据
+     *
+     * @param assoStructurePictures 架构图片数据对象集合
+     * @return 返回受影响的行数
+     */
+    int insertBatch(List<AssoStructurePicture> assoStructurePictures);
+
+}

+ 66 - 0
PAS/src/main/java/cn/cslg/pas/mapper/StructureMapper.java

@@ -0,0 +1,66 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.vo.StructureVO;
+import cn.cslg.pas.domain.Structure;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 架构表的Mapper层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+@Repository
+public interface StructureMapper {
+    /**
+     * 插入数据
+     *
+     * @param structure 数据对象
+     * @return 返回受影响的行数
+     */
+    int insert(Structure structure);
+
+    /**
+     * 根据id删除数据
+     *
+     * @param id 架构id
+     * @return 返回受影响的行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 根据id修改数据
+     *
+     * @param structure 数据对象
+     * @return 返回受影响的行数
+     */
+    int update(Structure structure);
+
+    /**
+     * 根据父级id和名称统计数量
+     *
+     * @param parentId      父级id
+     * @param structureName 架构名称
+     * @return 返回统计到的数量
+     */
+    int countByparentIdAndStructureName(Integer parentId, String structureName);
+
+    /**
+     * 根据id查询数据
+     *
+     * @param id 架构id
+     * @return 返回查询到的数据
+     */
+    Structure getStandardById(Integer id);
+
+    /**
+     * 根据父级id查询数据
+     *
+     * @param parentId 父级id
+     * @return 返回查询到的数据
+     */
+    List<StructureVO> selectByParentId(Integer parentId);
+
+}

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

@@ -0,0 +1,47 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.model.dto.StructureAddNewDTO;
+import cn.cslg.pas.common.model.dto.StructureQueryPageDTO;
+import cn.cslg.pas.common.model.dto.StructureUpdateDTO;
+import cn.cslg.pas.common.model.vo.StructureVO;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 架构的Service层接口
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+public interface IStructureService {
+    /**
+     * 新增架构
+     *
+     * @param structureAddNewDTO 新增架构DTO对象
+     * @param files              架构图片
+     */
+    @Transactional
+    void addNew(StructureAddNewDTO structureAddNewDTO, List<MultipartFile> files);
+
+
+    /**
+     * 修改架构
+     *
+     * @param structureUpdateDTO 修改架构DTO对象
+     * @param files              架构图片
+     */
+    @Transactional
+    void update(StructureUpdateDTO structureUpdateDTO, List<MultipartFile> files);
+
+    /**
+     * 分页查询架构
+     *
+     * @param structureQueryPageDTO 分页信息
+     * @return 返回查询到的数据
+     */
+    StructureVO query(StructureQueryPageDTO structureQueryPageDTO);
+
+}

+ 173 - 0
PAS/src/main/java/cn/cslg/pas/service/impl/StructureServiceImpl.java

@@ -0,0 +1,173 @@
+package cn.cslg.pas.service.impl;
+
+import cn.cslg.pas.common.model.dto.StructureAddNewDTO;
+import cn.cslg.pas.common.model.dto.StructureQueryPageDTO;
+import cn.cslg.pas.common.model.dto.StructureUpdateDTO;
+import cn.cslg.pas.common.model.dto.UploadFileDTO;
+import cn.cslg.pas.common.model.vo.StructureVO;
+import cn.cslg.pas.common.utils.FileUtils;
+import cn.cslg.pas.domain.Structure;
+import cn.cslg.pas.domain.asso.AssoStructurePicture;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.AssoStructurePictureMapper;
+import cn.cslg.pas.mapper.StructureMapper;
+import cn.cslg.pas.service.IStructureService;
+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/10
+ */
+@RequiredArgsConstructor
+@Slf4j
+@Service
+public class StructureServiceImpl implements IStructureService {
+    private final StructureMapper structureMapper;
+    private final AssoStructurePictureMapper assoStructurePictureMapper;
+    private final FileUtils fileUtils;
+
+    /**
+     * 新增架构
+     *
+     * @param structureAddNewDTO 新增架构DTO对象
+     * @param files              架构图片
+     */
+    @Override
+    public void addNew(StructureAddNewDTO structureAddNewDTO, List<MultipartFile> files) {
+        log.info("开始处理【新增架构】的业务,参数为:{}, {}", structureAddNewDTO, files);
+
+        //取出DTO中父级id,若父级id为null则表示该架构为第1级架构,手动给其父级id设为0
+        if (structureAddNewDTO.getParentId() == null) {
+            structureAddNewDTO.setParentId(0);
+        }
+
+        Integer parentId = structureAddNewDTO.getParentId();
+        String structureName = structureAddNewDTO.getStructureName();
+        //检查名称是否被占用(检查当前父级下是否有同名架构)
+        log.info("检查名称是否被占用(检查当前父级下是否有同名架构)");
+        int count = structureMapper.countByparentIdAndStructureName(parentId, structureName);
+        if (count > 0) {
+            String message = "新增架构失败,当前父级下已存在【" + structureName + "】";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //DTO对象赋值给实体类
+        Structure structure = new Structure();
+        BeanUtils.copyProperties(structureAddNewDTO, structure);
+        //数据入架构表(此时数据暂不含路径path)
+        log.info("数据入架构表");
+        int rows = structureMapper.insert(structure);
+        if (rows != 1) {
+            String message = "新增架构失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //数据入架构表后,取出id
+        Integer structureId = structure.getId();
+        String parentPath = structureAddNewDTO.getParentPath();
+        String path;
+        if (parentPath != null) {
+            path = parentPath + "," + structureId;
+        } else {
+            path = "0," + structureId;
+        }
+        structure.setPath(path);
+        log.info("更新架构表");
+        rows = structureMapper.update(structure);
+        if (rows != 1) {
+            String message = "新增架构失败,服务器忙请稍后再次尝试!";
+            log.info("{}", message);
+            throw new XiaoShiException(message);
+        }
+
+        //如果前端有传来架构图片,则图片上传服务器并获取图片信息,将图片信息入架构图片关联表
+        if (files != null && files.size() > 0) {
+            ArrayList<AssoStructurePicture> assoStructurePictures = new ArrayList<>();
+            for (MultipartFile file : files) {
+                UploadFileDTO fileDTO = fileUtils.uploadFile(file);
+                AssoStructurePicture assoStructurePicture = new AssoStructurePicture()
+                        .setStructureId(structureId)
+                        .setName(fileDTO.getName())
+                        .setSuffix(fileDTO.getExtName())
+                        .setUrl(fileDTO.getPath());
+                assoStructurePictures.add(assoStructurePicture);
+            }
+            rows = assoStructurePictureMapper.insertBatch(assoStructurePictures);
+            if (rows != assoStructurePictures.size()) {
+                String message = "新增架构失败,数据入架构图片关联表失败,服务器忙请稍后再次尝试!";
+                log.info("{}", message);
+                throw new XiaoShiException(message);
+            }
+        }
+
+        log.info("新增架构完成");
+
+    }
+
+    /**
+     * 修改架构
+     *
+     * @param structureUpdateDTO 修改架构DTO对象
+     * @param files              架构图片
+     */
+    @Override
+    public void update(StructureUpdateDTO structureUpdateDTO, List<MultipartFile> files) {
+    }
+
+    @Override
+    public StructureVO query(StructureQueryPageDTO structureQueryPageDTO) {
+        log.info("开始处理【分页查询架构】的业务,参数为:{}", structureQueryPageDTO);
+
+        //从DTO中取出产品id、架构id、架构名称
+        Integer productId = structureQueryPageDTO.getProductId();
+        Integer structureId = structureQueryPageDTO.getStructureId();
+        String structureName = structureQueryPageDTO.getStructureName();
+        StructureVO structureVO = new StructureVO()
+                .setProductId(productId)
+                .setId(structureId)
+                .setStructureName(structureName);
+        List<StructureVO> structureVOs = structureMapper.selectByParentId(structureId);
+        if (structureVOs != null) {
+            structureVO.setChildren(structureVOs);
+            for (StructureVO n : structureVOs) {
+                Integer nId = n.getId();
+                List<StructureVO> ns = structureMapper.selectByParentId(nId);
+                if (ns != null) {
+                    n.setChildren(ns);
+                    for (StructureVO b : ns) {
+                        Integer id = b.getId();
+                        List<StructureVO> nns = structureMapper.selectByParentId(nId);
+                    }
+                }
+            }
+        }
+
+        return structureVO;
+    }
+
+    //递归组装集合树
+    private void diGui(Integer structureId) {
+        ArrayList<StructureVO> structureVOS = new ArrayList<>();
+        List<StructureVO> structureVOs = structureMapper.selectByParentId(structureId);
+        if (structureVOs != null) {
+            for (StructureVO structureVO : structureVOs) {
+                structureId = structureVO.getId();
+                diGui(structureId);
+            }
+        }
+
+    }
+
+
+}

PAS/src/main/resources/mapper/ProductPictureMapper.xml → PAS/src/main/resources/mapper/AssoProductPictureMapper.xml


+ 15 - 0
PAS/src/main/resources/mapper/AssoStructurePictureMapper.xml

@@ -0,0 +1,15 @@
+<?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.AssoStructurePictureMapper">
+    <!--批量插入数据-->
+    <!--int insertBatch(List<AssoStructurePicture> assoStructurePictures);-->
+    <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
+        insert into asso_structure_picture (structure_id, name, suffix, url)
+        values
+        <foreach collection="list" item="n" separator=",">
+            (#{n.structureId}, #{n.name}, #{n.suffix}, #{n.url})
+        </foreach>
+    </insert>
+
+</mapper>

+ 2 - 7
PAS/src/main/resources/mapper/ProductMapper.xml

@@ -6,9 +6,9 @@
     <!--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)
+                             product_category_id, license_rate, create_person_id, create_person_name)
         values (#{productName}, #{marketTime}, #{companyName}, #{tenantId}, #{productExplain}, #{productCategoryId},
-                #{structureId}, #{licenseRate}, #{createPersonId}, #{createPersonName});
+                #{licenseRate}, #{createPersonId}, #{createPersonName});
     </insert>
 
     <!--根据id删除产品-->
@@ -42,9 +42,6 @@
             <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>
@@ -86,7 +83,6 @@
         tenant_id,
         product_explain,
         product_category_id,
-        structure_id,
         license_rate,
         create_person_name
         from product
@@ -115,7 +111,6 @@
         <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"

+ 113 - 0
PAS/src/main/resources/mapper/StructureMapper.xml

@@ -0,0 +1,113 @@
+<?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.StructureMapper">
+    <!--插入数据-->
+    <!--int insert(Structure structure);-->
+    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
+        insert into structure (parent_id, structure_name, path, remark, product_id)
+        values (#{parentId}, #{structureName}, #{path}, #{remark}, #{productId});
+    </insert>
+
+    <!--根据id删除数据-->
+    <!--int deleteById(Integer id);-->
+    <delete id="deleteById">
+        delete
+        from structure
+        where id = #{id}
+    </delete>
+
+    <!--根据id修改数据-->
+    <!--int update(Structure structure);-->
+    <update id="update">
+        update structure
+        <set>
+            <if test="parentId != null">
+                parent_id = #{parentId},
+            </if>
+            <if test="structureName != null">
+                structure_name = #{structureName},
+            </if>
+            <if test="path != null">
+                path = #{path},
+            </if>
+            <if test="remark != null">
+                remark = #{remark},
+            </if>
+            <if test="productId != null">
+                product_id = #{productId},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--根据父级id和名称统计数量-->
+    <!--int countByparentIdAndStructureName(Integer parentId, String structureName);-->
+    <select id="countByparentIdAndStructureName" resultType="int">
+        select count(*)
+        from structure
+        where structure_name = #{structureName}
+          and parent_id = #{parentId}
+    </select>
+
+    <!--根据id查询数据-->
+    <!--Structure selectById(Integer id);-->
+    <select id="getStandardById" resultMap="getStandardByIdMap">
+        select id, parent_id, structure_name, path, remark, product_id
+        from structure
+        where id = #{id}
+    </select>
+
+    <resultMap id="getStandardByIdMap" type="cn.cslg.pas.domain.Structure">
+        <id column="id" property="id"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="structure_name" property="structureName"/>
+        <result column="path" property="path"/>
+        <result column="remark" property="remark"/>
+        <result column="product_id" property="productId"/>
+    </resultMap>
+
+    <!--根据父级id查询数据-->
+    <!--List<StructureVO> selectByParentId(Integer parentId);-->
+    <select id="selectByParentId" resultMap="selectByParentIdMap">
+        select id s_id,
+               parent_id,
+               structure_name,
+               path,
+               remark,
+               product_id
+        from structure
+        where parent_id = #{parentId}
+    </select>
+
+    <resultMap id="selectByParentIdMap" type="cn.cslg.pas.common.model.vo.StructureVO">
+        <id column="s_id" property="id"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="structure_name" property="structureName"/>
+        <result column="path" property="path"/>
+        <result column="remark" property="remark"/>
+        <result column="product_id" property="productId"/>
+        <collection property="pictures" ofType="cn.cslg.pas.common.model.vo.StructurePictureVO"
+                    select="selectByParentId2" column="s_id">
+        </collection>
+    </resultMap>
+
+    <select id="selectByParentId2" resultMap="selectByParentIdMap2">
+        select id,
+               structure_id,
+               name,
+               suffix,
+               url
+        from asso_structure_picture
+        where structure_id = #{s_id}
+    </select>
+
+    <resultMap id="selectByParentIdMap2" type="cn.cslg.pas.common.model.vo.StructurePictureVO">
+        <id column="id" property="id"/>
+        <result column="structure_id" property="structureId"/>
+        <result column="name" property="name"/>
+        <result column="suffix" property="suffix"/>
+        <result column="url" property="url"/>
+    </resultMap>
+
+</mapper>

+ 85 - 0
PAS/src/test/java/cn/cslg/pas/mapper/AssoProductCategoryPictureMapperTests.java

@@ -0,0 +1,85 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.vo.ProductCategoryPictureVO;
+import cn.cslg.pas.domain.asso.AssoProductCategoryPicture;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 产品类别图片关联表的Mapper层接口测试类
+ *
+ * @Author chenyu
+ * @Date 2023/3/7
+ */
+@Slf4j
+@SpringBootTest
+public class AssoProductCategoryPictureMapperTests {
+    @Autowired
+    private AssoProductCategoryPictureMapper assoProductCategoryPictureMapper;
+
+    @Test
+    void insert() {
+        AssoProductCategoryPicture assoProductCategoryPicture = new AssoProductCategoryPicture()
+                .setProductCategoryId(1)
+                .setUrl("dsadsadsa.png");
+        int rows = assoProductCategoryPictureMapper.insert(assoProductCategoryPicture);
+        log.info("插入数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void insertBatch() {
+        ArrayList<AssoProductCategoryPicture> assoProductCategoryPictures = new ArrayList<>();
+        log.info("批量插入前数据为:");
+        for (int i = 0; i < 5; i++) {
+            AssoProductCategoryPicture assoProductCategoryPicture = new AssoProductCategoryPicture()
+                    .setProductCategoryId(1)
+                    .setUrl("dsadsadsa.png" + (i + 1));
+            log.info("{}", assoProductCategoryPicture);
+            assoProductCategoryPictures.add(assoProductCategoryPicture);
+        }
+        int rows = assoProductCategoryPictureMapper.insertBatch(assoProductCategoryPictures);
+        log.info("批量插入数据完成,受影响的行数为:{}", rows);
+        log.info("批量插入后数据为:");
+        for (AssoProductCategoryPicture assoProductCategoryPicture : assoProductCategoryPictures) {
+            log.info("{}", assoProductCategoryPicture);
+        }
+    }
+
+    @Test
+    void deleteByProductCategoryId() {
+        int rows = assoProductCategoryPictureMapper.deleteByProductCategoryId(1);
+        log.info("根据产品类别id删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void queryListByProductCategoryId() {
+        List<ProductCategoryPictureVO> productCategoryPictureVOS = assoProductCategoryPictureMapper.selectByProductCategoryId(1);
+        log.info("根据产品类别id查询数据完成,数量为:{}", productCategoryPictureVOS.size());
+        log.info("数据信息为:");
+        for (ProductCategoryPictureVO productCategoryPictureVO : productCategoryPictureVOS) {
+            log.info("{}", productCategoryPictureVO);
+        }
+    }
+
+    @Test
+    void deleteByIds() {
+        ArrayList<Integer> ids = new ArrayList<>();
+        ids.add(1);
+        ids.add(4);
+        int rows = assoProductCategoryPictureMapper.deleteByIds(ids);
+        log.info("根据id批量删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void countByProductCategoryId() {
+        int count = assoProductCategoryPictureMapper.countByProductCategoryId(4);
+        log.info("根据产品类别id统计数量完成,数量为:{}", count);
+    }
+
+
+}

+ 71 - 0
PAS/src/test/java/cn/cslg/pas/mapper/AssoProductPictureMapperTests.java

@@ -0,0 +1,71 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.vo.ProductPictureVO;
+import cn.cslg.pas.domain.asso.AssoProductPicture;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 产品图片关联表的Mapper层接口测试类
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@Slf4j
+@SpringBootTest
+public class AssoProductPictureMapperTests {
+    @Autowired
+    private AssoProductPictureMapper assoProductPictureMapper;
+
+    @Test
+    void insertBatch() {
+        ArrayList<AssoProductPicture> assoProductPictures = new ArrayList<>();
+        log.info("批量插入前数据为:");
+        for (int i = 0; i < 3; i++) {
+            AssoProductPicture assoProductPicture = new AssoProductPicture()
+                    .setProductId(2)
+                    .setName("图片" + (i + 1))
+                    .setSuffix("jpg" + (i + 1))
+                    .setUrl("/20220308/sdadsadsa.jpg" + (i + 1));
+            log.info("{}", assoProductPicture);
+            assoProductPictures.add(assoProductPicture);
+        }
+        int rows = assoProductPictureMapper.insertBatch(assoProductPictures);
+        log.info("批量插入数据完成,受影响的行数为:{}", rows);
+        log.info("批量插入后数据为:");
+        for (AssoProductPicture assoProductPicture : assoProductPictures) {
+            log.info("{}", assoProductPicture);
+        }
+    }
+
+    @Test
+    void deletByProductId() {
+        int rows = assoProductPictureMapper.deleteByProductId(5);
+        log.info("根据产品id删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void deleteByIds() {
+        ArrayList<Integer> ids = new ArrayList<>();
+        ids.add(14);
+        ids.add(16);
+        int rows = assoProductPictureMapper.deleteByIds(ids);
+        log.info("根据id集合批量删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void selectByProductId() {
+        List<ProductPictureVO> productPictureVOS = assoProductPictureMapper.selectByProductId(2);
+        log.info("根据产品id查询数据完成,数据信息为");
+        for (ProductPictureVO productPictureVO : productPictureVOS) {
+            log.info("{}", productPictureVO);
+        }
+    }
+
+
+}

+ 44 - 0
PAS/src/test/java/cn/cslg/pas/mapper/AssoStructurePictureMapperTests.java

@@ -0,0 +1,44 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.asso.AssoStructurePicture;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.ArrayList;
+
+/**
+ * 架构图片关联表的Mapper层接口测试类
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+@Slf4j
+@SpringBootTest
+public class AssoStructurePictureMapperTests {
+    @Autowired
+    private AssoStructurePictureMapper assoStructurePictureMapper;
+
+    @Test
+    void insertBatch() {
+        ArrayList<AssoStructurePicture> assoStructurePictures = new ArrayList<>();
+        log.info("批量插入前数据为:");
+        for (int i = 0; i < 3; i++) {
+            AssoStructurePicture assoStructurePicture = new AssoStructurePicture()
+                    .setStructureId(1)
+                    .setName("手机屏幕图片" + (i + 1))
+                    .setSuffix("jpg" + (i + 1))
+                    .setUrl("sdasa.jpg" + (i + 1));
+            log.info("{}", assoStructurePicture);
+            assoStructurePictures.add(assoStructurePicture);
+        }
+        int rows = assoStructurePictureMapper.insertBatch(assoStructurePictures);
+        log.info("批量插入数据完成,受影响的行数为:{}", rows);
+        log.info("批量插入后数据为:");
+        for (AssoStructurePicture assoStructurePicture : assoStructurePictures) {
+            log.info("{}", assoStructurePicture);
+        }
+    }
+
+}

+ 80 - 0
PAS/src/test/java/cn/cslg/pas/mapper/ProductCategoryMapperTests.java

@@ -0,0 +1,80 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.dto.ProductCategoryQueryPageDTO;
+import cn.cslg.pas.common.model.vo.ProductCategoryVO;
+import cn.cslg.pas.domain.ProductCategory;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+/**
+ * 产品类别的Mapper层接口测试类
+ *
+ * @Author chenyu
+ * @Date 2023/3/7
+ */
+@Slf4j
+@SpringBootTest
+public class ProductCategoryMapperTests {
+    @Autowired
+    private ProductCategoryMapper productCategoryMapper;
+
+    @Test
+    void insert() {
+        ProductCategory productCategory = new ProductCategory()
+                .setProductCategoryName("主机2")
+                .setRemark("测试备注2")
+                .setLicenseRate(0.44)
+                .setCreatePersonId(155)
+                .setCreatePersonName("陈宇");
+        int rows = productCategoryMapper.insert(productCategory);
+        log.info("插入数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void deleteById() {
+        int rows = productCategoryMapper.deleteById(2);
+        log.info("根据id删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void updateById() {
+        ProductCategory productCategory = new ProductCategory()
+                .setId(1)
+                .setProductCategoryName("修改测试产品类别")
+                //.setRemark("测试修改")
+                .setLicenseRate(0.66);
+        int rows = productCategoryMapper.updateById(productCategory);
+        log.info("根据id修改数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void countByProductCategoryName() {
+        int count = productCategoryMapper.countByProductCategoryName("修改测试产品类别");
+        log.info("根据产品类别名称统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void countById() {
+        int count = productCategoryMapper.countById(6);
+        log.info("根据产品类别id统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void query() {
+        ProductCategoryQueryPageDTO productCategoryQueryPageDTO = new ProductCategoryQueryPageDTO();
+//                .setProductCategoryName("机")
+//                .setCreatePersonName("宇");
+        List<ProductCategoryVO> queryResult = productCategoryMapper.query(productCategoryQueryPageDTO);
+        log.info("查询产品类别完成,数量为:{}", queryResult.size());
+        log.info("数据信息为:");
+        for (ProductCategoryVO productCategoryVO : queryResult) {
+            log.info("{}", productCategoryVO);
+        }
+    }
+
+
+}

+ 97 - 0
PAS/src/test/java/cn/cslg/pas/mapper/ProductMapperTests.java

@@ -0,0 +1,97 @@
+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 lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品表的Mapper层接口测试类
+ *
+ * @Author chenyu
+ * @Date 2023/3/8
+ */
+@Slf4j
+@SpringBootTest
+public class ProductMapperTests {
+    @Autowired
+    private ProductMapper productMapper;
+
+    @Test
+    void insert() {
+        Product product = new Product()
+                .setProductName("测试产品名称1")
+                .setMarketTime(new Date())
+                .setCompanyName("测试公司1")
+                .setTenantId(1)
+                .setProductExplain("测试产品说明1")
+                .setProductCategoryId(1)
+                .setLicenseRate(0.11)
+                .setCreatePersonId(155)
+                .setCreatePersonName("陈宇");
+        int rows = productMapper.insert(product);
+        log.info("插入数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void deleteById() {
+        int rows = productMapper.deleteById(1);
+        log.info("根据id删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void updateById() {
+        Product product = new Product()
+                .setId(1)
+                .setProductName("更改产品名称1")
+                .setMarketTime(new Date())
+                .setCompanyName("更改公司1")
+                .setTenantId(2)
+                .setProductExplain("更改产品说明1")
+                .setProductCategoryId(2)
+                .setLicenseRate(0.22)
+                .setCreatePersonId(155)
+                .setCreatePersonName("陈宇");
+        int rows = productMapper.updateById(product);
+        log.info("根据id修改数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void countByProductName() {
+        int count = productMapper.countByProductName("测试产品名称");
+        log.info("根据名称统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void countById() {
+        int count = productMapper.countById(1);
+        log.info("根据id统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void countByProductCategoryId() {
+        int count = productMapper.countByProductCategoryId(1);
+        log.info("根据所属产品类别id统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void query() {
+        ProductQueryPageDTO productQueryPageDTO = new ProductQueryPageDTO()
+                .setProductName("测")
+                .setCompanyName("司")
+                .setPatentNo("15")
+                .setProductCategoryId(1);
+        List<ProductVO> queryResults = productMapper.query(productQueryPageDTO);
+        log.info("分页查询产品数据完成,数据信息为:");
+        for (ProductVO queryResult : queryResults) {
+            log.info("{}", queryResult);
+        }
+    }
+
+}

+ 89 - 0
PAS/src/test/java/cn/cslg/pas/mapper/ProductMarketDataMapperTests.java

@@ -0,0 +1,89 @@
+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 lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 产品营销数据表的Mapper层接口测试类
+ *
+ * @Author chenyu
+ * @Date 2023/3/9
+ */
+@Slf4j
+@SpringBootTest
+public class ProductMarketDataMapperTests {
+    @Autowired
+    private ProductMarketDataMapper productMarketDataMapper;
+
+    @Test
+    void insert() {
+        ProductMarketData productMarketData = new ProductMarketData()
+                .setProductId(2)
+                .setSaleTime("20230309")
+                .setSaleArea("苏州")
+                .setSaleCount(12005)
+                .setSaleMoney(12.005)
+                .setCustomLicenseRate(0.37)
+                .setCreatePersonId(155)
+                .setCreatePersonName("陈宇");
+        int rows = productMarketDataMapper.insert(productMarketData);
+        log.info("插入数据完成,受影响的行数为:{}", rows);
+
+    }
+
+    @Test
+    void deleteById() {
+        int rows = productMarketDataMapper.deleteById(1);
+        log.info("根据id删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void update() {
+        ProductMarketData productMarketData = new ProductMarketData()
+                .setId(6)
+                .setProductId(6)
+                .setSaleTime("20230309")
+                .setSaleArea("南京")
+                .setSaleCount(20022)
+                .setSaleMoney(20.022)
+                .setCustomLicenseRate(0.63);
+        int rows = productMarketDataMapper.update(productMarketData);
+        log.info("根据id修改数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void countByProductIdSaleAreaSaleTime() {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+        String dateString = simpleDateFormat.format(new Date());
+        System.out.println(dateString);
+        int count = productMarketDataMapper.countByProductIdSaleAreaSaleTime(2, "苏州", "20230309");
+        log.info("根据所属产品id、营销地区、营销时间统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void countById() {
+        int count = productMarketDataMapper.countById(6);
+        log.info("根据id统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void query() {
+        ProductMarketDataQueryPageDTO productMarketDataQueryPageDTO = new ProductMarketDataQueryPageDTO()
+                .setProductId(6);
+        List<ProductMarketDataVO> productMarketDataVOs = productMarketDataMapper.query(productMarketDataQueryPageDTO);
+        log.info("分页查询数据完成,数据信息为:");
+        for (ProductMarketDataVO productMarketDataVO : productMarketDataVOs) {
+            log.info("{}", productMarketDataVO);
+        }
+    }
+
+}

+ 76 - 0
PAS/src/test/java/cn/cslg/pas/mapper/StructureMapperTests.java

@@ -0,0 +1,76 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.common.model.vo.StructureVO;
+import cn.cslg.pas.domain.Structure;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+/**
+ * 架构表的Mapper层接口测试类
+ *
+ * @Author chenyu
+ * @Date 2023/3/10
+ */
+@Slf4j
+@SpringBootTest
+public class StructureMapperTests {
+    @Autowired
+    private StructureMapper structureMapper;
+
+    @Test
+    void insert() {
+        Structure structure = new Structure()
+                .setParentId(1)
+                .setPath("0,1,3")
+                .setStructureName("手机背板")
+                .setRemark("手机的二级架构")
+                .setProductId(2);
+        int rows = structureMapper.insert(structure);
+        log.info("插入数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void delete() {
+        int rows = structureMapper.deleteById(0);
+        log.info("根据id删除数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void update() {
+        Structure structure = new Structure()
+                .setParentId(0)
+                .setPath("0,1")
+                .setStructureName("手机")
+                .setRemark("手机的一级架构呀")
+                .setProductId(2);
+        int rows = structureMapper.update(structure);
+        log.info("修改数据完成,受影响的行数为:{}", rows);
+    }
+
+    @Test
+    void countByparentIdAndStructureName() {
+        int count = structureMapper.countByparentIdAndStructureName(0, "手机后壳");
+        log.info("根据名称统计数量完成,数量为:{}", count);
+    }
+
+    @Test
+    void getStandardById() {
+        Structure structure = structureMapper.getStandardById(3);
+        log.info("根据id查询数据完成,数据信息为:{}", structure);
+    }
+
+    @Test
+    void selectByParentId() {
+        List<StructureVO> structureVOs = structureMapper.selectByParentId(3);
+        log.info("根据父级id查询子级架构完成,数据信息为:");
+        for (StructureVO structureVO : structureVOs) {
+            log.info("{}", structureVO);
+        }
+
+    }
+
+}