Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

lwhhszx před 1 rokem
rodič
revize
764fb097c0

+ 7 - 2
src/main/java/cn/cslg/pas/common/dto/business/ProductCategoryDTO.java

@@ -1,10 +1,13 @@
 package cn.cslg.pas.common.dto.business;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import org.joda.time.DateTime;
+import org.springframework.format.annotation.DateTimeFormat;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -21,11 +24,13 @@ public class ProductCategoryDTO {
     @Schema(description = "参考许可费率")
     private Double licenseRate;
     @Schema(description = "上市时间")
-    private DateTime marketTime;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date marketTime;
     @Schema(description = "可见类型(0所有人可见、1本人可见、2仅选定人可见、3选定人不可见)")
     private Integer showType;
     @Schema(description = "描述")
     private String description;
     @Schema(description = "可见类型的人员id")
-    private List<Integer> showPersonId;
+    private List<Integer> showPersonIds;
 }

+ 35 - 0
src/main/java/cn/cslg/pas/common/dto/business/UpdateProductCategoryDTO.java

@@ -0,0 +1,35 @@
+package cn.cslg.pas.common.dto.business;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2023/10/31
+ */
+@Data
+public class UpdateProductCategoryDTO {
+    @Schema(description = "id")
+    private Integer id;
+    @Schema(description = "产品类别名称")
+    private String Name;
+    @Schema(description = "参考许可费率")
+    private Double licenseRate;
+    @Schema(description = "上市时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date marketTime;
+    @Schema(description = "可见类型(0所有人可见、1本人可见、2仅选定人可见、3选定人不可见)")
+    private Integer showType;
+    @Schema(description = "描述")
+    private String description;
+    @Schema(description = "可见类型的人员id")
+    private List<Integer> showPersonIds;
+    @Schema(description = "文件guid")
+    private List<String> guids;
+}

+ 1 - 2
src/main/java/cn/cslg/pas/common/model/request/StringRequest.java

@@ -6,6 +6,5 @@ import lombok.experimental.Accessors;
 @Data
 @Accessors(chain = true)
 public class StringRequest extends QueryRequest{
-  private   String searchQuery;
-
+  private String searchQuery;
 }

+ 2 - 0
src/main/java/cn/cslg/pas/common/vo/business/ProductCategoryVO.java

@@ -25,6 +25,8 @@ public class ProductCategoryVO {
     private DateTime marketTime;
     @Schema(description = "可见类型(0所有人可见、1本人可见、2仅选定人可见、3选定人不可见)")
     private Integer showType;
+    @Schema(description = "可见人员ids")
+    private List<Integer> showPersonIds;
     @Schema(description = "描述")
     private String description;
     @Schema(description = "创建人")

+ 47 - 0
src/main/java/cn/cslg/pas/common/vo/business/TreeNodeVO.java

@@ -0,0 +1,47 @@
+package cn.cslg.pas.common.vo.business;
+
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 架构VO
+ * @Author xiexiang
+ * @Date 2023/10/31
+ */
+@Data
+public class TreeNodeVO {
+    @Schema(description = "id")
+    private Integer id;
+    @Schema(description = "节点名称")
+    private String name;
+    /**
+     * (1产品类别,2产品,3技术分类,4自定义树)
+     */
+    @Schema(description = "类型")
+    private Integer type;
+    @Schema(description = "父id")
+    private Integer parentId;
+    /**
+     * (所属产品/产品类别/自定义树/技术分类)
+     */
+    @Schema(description = "抽象id")
+    private Integer typeId;
+    @Schema(description = "路径")
+    private String path;
+    @Schema(description = "层级")
+    private Integer level;
+    @Schema(description = "创建人id")
+    private Integer createId;
+    @Schema(description = "创建人")
+    private String createName;
+    @Schema(description = "创建时间")
+    private DateTime createTime;
+
+    @Schema(description = "文件信息")
+    private List<SystemFile> systemFileList;
+}

+ 5 - 4
src/main/java/cn/cslg/pas/controller/ProductCategoryController.java

@@ -2,6 +2,7 @@ package cn.cslg.pas.controller;
 
 import cn.cslg.pas.common.core.base.Constants;
 import cn.cslg.pas.common.dto.business.ProductCategoryDTO;
+import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.model.request.StringRequest;
 import cn.cslg.pas.common.utils.Response;
 
@@ -34,16 +35,16 @@ public class ProductCategoryController {
 
     @Operation(summary = "查询产品类别")
     @PostMapping("/queryProductCategory")
-    public String queryProductCategory(StringRequest stringRequest) throws Exception {
+    public Response queryProductCategory(StringRequest stringRequest) throws Exception {
         Business business = businessFactory.getClass("productCategoryService");
-        business.queryMessage(stringRequest);
-        return "";
+        Records records = (Records) business.queryMessage(stringRequest);
+        return Response.success(records);
     }
 
     @Operation(summary = "添加产品类别")
     @PostMapping("/addProductCategory")
     public Response addProductCategory(String productCategory, List<MultipartFile> files) throws Exception {
-        if (productCategory != null) {
+        if (productCategory != null && productCategory != "") {
             ProductCategoryDTO productCategoryDTO = JSONObject.parseObject(productCategory, ProductCategoryDTO.class);
             Business business = businessFactory.getClass("productCategoryService");
             Integer id = null;

+ 3 - 6
src/main/java/cn/cslg/pas/domain/business/AssoProductCategoryPerson.java

@@ -1,22 +1,19 @@
 package cn.cslg.pas.domain.business;
 
+import cn.cslg.pas.domain.BaseEntity;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 import org.joda.time.DateTime;
 
 /**
+ * 产品类别与可见人员关联表
  * @Author xiexiang
  * @Date 2023/10/31
  */
 @Data
 @TableName("asso_product_category_person")
-public class AssoProductCategoryPerson {
-    /**
-     * 主键id
-     */
-    @TableField(value = "id")
-    private Integer id;
+public class AssoProductCategoryPerson extends BaseEntity<AssoProductCategoryPerson> {
 
     /**
      * 产品类别id

+ 6 - 0
src/main/java/cn/cslg/pas/domain/business/ProductCategory.java

@@ -52,4 +52,10 @@ public class ProductCategory extends BaseEntity<ProductCategory> {
      */
     @TableField(value = "create_time")
     private DateTime createTime;
+
+    /**
+     * 所属租户
+     */
+    @TableField(value = "tenant")
+    private Integer tenant;
 }

+ 0 - 5
src/main/java/cn/cslg/pas/domain/business/TreeNode.java

@@ -16,11 +16,6 @@ import lombok.Data;
 @Data
 @TableName("tree_node")
 public class TreeNode extends BaseEntity<TreeNode> {
-    /**
-     * 主键
-     */
-    @TableField(value = "id")
-    private Integer id;
 
     /**
      * 节点名称

+ 4 - 1
src/main/java/cn/cslg/pas/mapper/TreeNodeMapper.java

@@ -1,9 +1,12 @@
 package cn.cslg.pas.mapper;
 
+import cn.cslg.pas.common.vo.business.TreeNodeVO;
 import cn.cslg.pas.domain.business.TreeNode;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * 架构的Mapper层
  * @Author xiexiang
@@ -11,5 +14,5 @@ import org.springframework.stereotype.Repository;
  */
 @Repository
 public interface TreeNodeMapper extends BaseMapper<TreeNode> {
-
+    List<TreeNodeVO> getTreeNode(String sql1, String sql2, String sql3);
 }

+ 52 - 10
src/main/java/cn/cslg/pas/service/business/ProductCategoryService.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.dto.business.ProductCategoryDTO;
+import cn.cslg.pas.common.dto.business.UpdateProductCategoryDTO;
 import cn.cslg.pas.common.model.cronModel.*;
 import cn.cslg.pas.common.model.request.GroupRequest;
 import cn.cslg.pas.common.model.request.QueryRequest;
@@ -61,6 +62,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
 
     @Autowired
     private FormatQueryService formatQueryService;
+
     @Autowired
     private PermissionService permissionService;
 
@@ -69,6 +71,15 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
         List<String> sqls = formatQueryService.reSqls(queryRequest,"productCategory");
         //根据sql查询产品类别信息
         List<ProductCategoryVO> productCategoryVOS = productCategoryMapper.getProductCategory(sqls.get(0),sqls.get(1),sqls.get(2));
+        productCategoryVOS.forEach(item -> {
+            Integer showType = item.getShowType();
+            LambdaQueryWrapper<AssoProductCategoryPerson> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(AssoProductCategoryPerson::getProductCategoryId, item.getId());
+            queryWrapper.eq(AssoProductCategoryPerson::getRole,showType);
+            List<AssoProductCategoryPerson> assoProductCategoryPeople = assoProductCategoryPersonService.list(queryWrapper);
+            List<Integer> showPersonIds = assoProductCategoryPeople.stream().map(AssoProductCategoryPerson::getPersonId).collect(Collectors.toList());
+            item.setShowPersonIds(showPersonIds);
+        });
         //查询总数
         Long total = productCategoryMapper.getProductCategoryCount(sqls.get(0));
         //装载产品类别信息
@@ -111,11 +122,13 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
         //产品类别入表
         ProductCategory productCategory = new ProductCategory();
         BeanUtils.copyProperties(productCategoryDTO, productCategory);
+        productCategory.setCreateId(personnelVO.getId());
+        productCategory.setTenant(personnelVO.getTenantId());
         productCategory.insert();
         //判断可见类型:
         Integer showType = productCategoryDTO.getShowType();
         if(showType != 0 && showType != 1){
-            List<Integer> showPersonIds = productCategoryDTO.getShowPersonId();
+            List<Integer> showPersonIds = productCategoryDTO.getShowPersonIds();
             //0所有人可见,1本人可见
             if(showPersonIds !=null && showPersonIds.size() != 0){
                 List<AssoProductCategoryPerson> assoProductCategoryPeople = new ArrayList<>();
@@ -196,27 +209,56 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
     @Override
     public Object updateMessage(Object object, List<MultipartFile> files) {
         //object to productCategory
-        ProductCategoryDTO productCategoryDTO = (ProductCategoryDTO)object;
+        UpdateProductCategoryDTO updateProductCategoryDTO = (UpdateProductCategoryDTO)object;
+        if(updateProductCategoryDTO == null || updateProductCategoryDTO.getId() == null){
+            throw new XiaoShiException("参数错误");
+        }
+        ProductCategory productCategory = this.getById(updateProductCategoryDTO.getId());
         //检测名称是否不规范
-        productCategoryDTO.setName(productCategoryDTO.getName().trim());
+        updateProductCategoryDTO.setName(updateProductCategoryDTO.getName().trim());
         //根据名称查询数据库中是否存在
-        String name = productCategoryDTO.getName();
+        String name = updateProductCategoryDTO.getName();
         LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ProductCategory::getName, name);
         List<ProductCategory> productCategories = this.list(queryWrapper);
-        if (productCategories == null && productCategories.size() == 0) {
-            return null;
+        if(updateProductCategoryDTO.getName() == productCategory.getName() && productCategories.size() != 0){
+            throw new XiaoShiException("名称重复");
+        }
+        BeanUtils.copyProperties(updateProductCategoryDTO, productCategory);
+        productCategory.updateById();
+        //根据产品类别id查询对应的附件id
+        LambdaQueryWrapper<AssoProductCategoryFile> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(AssoProductCategoryFile::getProductCategoryId, updateProductCategoryDTO.getId());
+        List<AssoProductCategoryFile> assoFiles = assoProductCategoryFileService.list(wrapper);
+        List<String> fileGuIds = assoFiles.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
+        //获取更新后的附件ids
+        List<String> updateFileGuIds = new ArrayList<>();
+        if(updateProductCategoryDTO.getGuids() != null && updateProductCategoryDTO.getGuids().size() != 0){
+            updateFileGuIds = updateProductCategoryDTO.getGuids();
+        }
+        fileGuIds.retainAll(updateFileGuIds);
+        //做差获得被删除的文件id
+        if(fileGuIds.size() != 0){
+            //根据文件id删除产品类别与文件关联表记录
+            LambdaQueryWrapper<AssoProductCategoryFile> deleteWrapper = new LambdaQueryWrapper<>();
+            deleteWrapper.in(AssoProductCategoryFile::getFileGuid, fileGuIds);
+            assoProductCategoryFileService.remove(deleteWrapper);
+
+            //远程删除服务器上传文件
+            try{
+                fileManagerService.deleteFileFromFMS(fileGuIds);
+            } catch (Exception e){
+
+            }
         }
         //获取登陆人信息 用于设置创建人
-        PersonnelVO personnelVO;
+        PersonnelVO personnelVO = new PersonnelVO();
         try {
             personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         } catch (Exception e) {
             throw new UnLoginException("未登录");
         }
-        ProductCategory productCategory = this.getById(productCategoryDTO.getId());
-        BeanUtils.copyProperties(productCategoryDTO, productCategory);
-        productCategory.insert();
+        //添加文件
         if (files != null && files.size() != 0) {
             try {
                 List<String> guids = fileManagerService.uploadFileGetGuid(files);

+ 86 - 5
src/main/java/cn/cslg/pas/service/business/TreeNodeService.java

@@ -1,12 +1,12 @@
 package cn.cslg.pas.service.business;
 
 import cn.cslg.pas.common.dto.business.TreeNodeDTO;
-import cn.cslg.pas.common.model.cronModel.GroupVO;
-import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.model.cronModel.*;
 import cn.cslg.pas.common.model.request.GroupRequest;
 import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.utils.CacheUtils;
 import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.common.vo.business.TreeNodeVO;
 import cn.cslg.pas.domain.business.AssoTreeNodeFile;
 import cn.cslg.pas.domain.business.TreeNode;
 import cn.cslg.pas.exception.UnLoginException;
@@ -14,6 +14,9 @@ import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.factorys.businessFactory.Business;
 import cn.cslg.pas.mapper.TreeNodeMapper;
 import cn.cslg.pas.service.common.FileManagerService;
+import cn.cslg.pas.service.permissions.PermissionService;
+import cn.cslg.pas.service.query.FormatQueryService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
@@ -52,11 +55,26 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
     @Autowired
     private LoginUtils loginUtils;
 
+    @Autowired
+    private FormatQueryService formatQueryService;
+
+    @Autowired
+    private PermissionService permissionService;
+
     @Override
     public Object queryMessage(QueryRequest queryRequest) throws Exception {
-        return null;
+        List<String> sqls = formatQueryService.reSqls(queryRequest,"treeNode");
+        //根据sql查询产品架构信息
+        List<TreeNodeVO> treeNodeVOS = treeNodeMapper.getTreeNode(sqls.get(0),sqls.get(1),sqls.get(2));
+        //装载产品类别信息
+        this.loadTreeNode(treeNodeVOS);
+        Records records = new Records();
+        records.setCurrent(queryRequest.getCurrent());
+        records.setSize(queryRequest.getSize());
+        records.setData(treeNodeVOS);
+//        records.setTotal(total);
+        return records;
     }
-
     /**
      * 新增架构
      * @param object
@@ -68,7 +86,7 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
         //object to treeNode
         TreeNodeDTO treeNodeDTO = (TreeNodeDTO)object;
         //获取登录人信息
-        PersonnelVO personnelVO =new PersonnelVO();
+        PersonnelVO personnelVO = new PersonnelVO();
         try {
             personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         }
@@ -197,4 +215,67 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
     public GroupVO getGroup(GroupRequest groupRequest,String tableName) throws Exception {
         return null;
     }
+
+    private void loadTreeNode(List<TreeNodeVO> treeNodeVOS) throws IOException {
+        List<Integer> createIds = new ArrayList<>();
+        List<Integer> ids = new ArrayList<>();
+        treeNodeVOS.forEach(
+                item -> {
+                    if(item.getCreateId() != null){
+                        createIds.add(item.getCreateId());
+                    }
+                    if (item.getId() != null) {
+                        ids.add(item.getId());
+                    }
+                }
+        );
+
+        List<Personnel> personnels = new ArrayList<>();
+        List<String> guids = new ArrayList<>();
+        List<SystemFile> systemFiles = new ArrayList<>();
+
+        List<AssoTreeNodeFile> assoTreeNodeFiles = new ArrayList<>();
+
+        if (ids.size() != 0) {
+            //根据架构id获得架构与文件关联表
+            LambdaQueryWrapper<AssoTreeNodeFile> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.in(AssoTreeNodeFile::getTreeNodeId, ids);
+            assoTreeNodeFiles = assoTreeNodeFileService.list(queryWrapper);
+            guids = assoTreeNodeFiles.stream().map(AssoTreeNodeFile::getFileGuid).collect(Collectors.toList());
+        }
+
+        //查询创建人名称
+        if (createIds.size() != 0) {
+            String res = permissionService.getPersonnelByIdsFromPCS(createIds);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            personnels = JSONObject.parseArray(jsonObject.getString("data"), Personnel.class);
+        }
+
+        //查询文件
+        if (guids.size() != 0) {
+            String res = fileManagerService.getSystemFileFromFMS(guids);
+            JSONObject jsonObject = JSONObject.parseObject(res);
+            systemFiles = JSONObject.parseArray(jsonObject.getString("data"), SystemFile.class);
+        }
+
+        //装载信息
+        for(TreeNodeVO treeNodeVO:treeNodeVOS){
+            //装载人员信息
+            Personnel personnel = personnels.stream().filter(item -> item.getId().equals(treeNodeVO.getCreateId())).findFirst().orElse(null);
+            if(personnel != null){
+                treeNodeVO.setCreateName(personnel.getPersonnelName());
+            }
+            //装载文件信息
+            List<AssoTreeNodeFile> assoTreeNodeFilesTemp = assoTreeNodeFiles.stream().filter(item -> item.getTreeNodeId().equals(treeNodeVO.getId())).collect(Collectors.toList());
+            if(assoTreeNodeFilesTemp.size() != 0){
+                List<String> guidTemp = assoTreeNodeFilesTemp.stream().map(AssoTreeNodeFile::getFileGuid).collect(Collectors.toList());
+                if (guidTemp.size() != 0) {
+                    List<SystemFile> systemFileTemp = systemFiles.stream().filter(item -> guidTemp.contains(item.getGuid())).collect(Collectors.toList());
+                    if (systemFileTemp.size() != 0) {
+                        treeNodeVO.setSystemFileList(systemFileTemp);
+                    }
+                }
+            }
+        }
+    }
 }

+ 93 - 0
src/main/resources/jsons/productCategory.json

@@ -0,0 +1,93 @@
+[
+  {"name":"Id",
+    "type":"Integer",
+    "value":"id",
+    "field":"id",
+    "sqlField": "id",
+    "sqlClass": "",
+    "orderClass": "",
+    "groupClass":"",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  },
+  {"name":"产品类别名称",
+    "type":"String",
+    "value":"name",
+    "field": "name",
+    "sqlField": "name",
+    "sqlClass": "",
+    "orderClass": "",
+    "groupClass":"",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  },
+  {"name":"参考许可费率",
+    "type":"Double",
+    "value":"licenseRate",
+    "field": "licenseRate",
+    "sqlField": "license_rate",
+    "sqlClass": "",
+    "orderClass": "",
+    "groupClass":"",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  },
+  {"name":"上市时间",
+    "type":"DateTime",
+    "value":"marketTime",
+    "field": "marketTime",
+    "sqlField": "market_time",
+    "orderClass": "",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  },
+  {"name":"可见类型",
+    "type":"Integer",
+    "value":"showType",
+    "field": "showType",
+    "sqlField": "show_type",
+    "sqlClass": "",
+    "orderClass": "",
+    "groupClass":"",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  },
+  {"name":"描述",
+    "type":"String",
+    "value":"description",
+    "field": "description",
+    "sqlField": "description",
+    "sqlClass": "",
+    "orderClass": "",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  },
+  {"name":"创建人",
+    "type":"String",
+    "value":"createName",
+    "field": "createName",
+    "sqlField": "createId",
+    "sqlClass": "",
+    "orderClass": "",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  },
+  {
+    "name":"创建时间",
+    "type":"DateTime",
+    "value":"createTime",
+    "field":"createTime",
+    "sqlField": "create_time",
+    "orderClass": "",
+    "ifSearch":"true",
+    "ifGroup": "false",
+    "ifShow":"true"
+  }
+]

+ 40 - 0
src/main/resources/mapper/ProductCategortMapper.xml

@@ -0,0 +1,40 @@
+<?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.ProductCategoryMapper">
+    <!--namespace根据自己需要创建的的mapper的路径和名称填写-->
+    <select id="getProductCategory"  resultType="cn.cslg.pas.common.vo.business.ProductCategoryVO">
+        select id,name,license_rate as licenseRate,market_time as marketTime,show_type as showType,description,create_id as createId,create_time as createTime, tenant from product_category
+
+        <if test="sql1!=''">
+
+            where    ${sql1}
+        </if>
+
+
+        ${sql2} ${sql3}
+    </select>
+
+    <select id="getProductCategoryCount" resultType="java.lang.Long">
+        select count(*) from product_category
+        <if test="sql!=''">
+
+            where    ${sql}
+        </if>
+    </select>
+    <select id="getGroups"  resultType="java.lang.String">
+        select ${selectField} from  ${tableName}
+        <if test="sqls.get(0)!=''">
+            where    ${sqls.get(0)}
+        </if>
+        group by ${groupField} ${sqls.get(1)}  ${sqls.get(2)}
+    </select>
+
+    <select id="getGroupsCount"  resultType="java.lang.Long">
+        select count(*) from (select ${selectField} from ${tableName}
+        <if test="sqls.get(0)!=''">
+            where ${sqls.get(0)}
+        </if>
+        group by ${groupField}
+        ) as c
+    </select>
+</mapper>

+ 5 - 0
src/main/resources/mapper/TreeNodeMapper.xml

@@ -0,0 +1,5 @@
+<?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.TreeNodeMapper">
+    <!--namespace根据自己需要创建的的mapper的路径和名称填写-->
+</mapper>