From ab25f94a1e593001bf993d182f9a3860fd098583 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: 星期二, 15 七月 2025 10:27:11 +0800
Subject: [PATCH] 新增
---
multi-system/src/main/resources/mapper/system/ProductItemMapper.xml | 68 +++++++++++
multi-system/src/main/java/com/gkhy/exam/system/mapper/ProductItemMapper.java | 15 ++
multi-system/src/main/java/com/gkhy/exam/system/service/impl/CatalogueServiceImpl.java | 7 +
multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml | 3
multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java | 93 +++++++++++++++
multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java | 62 ++++++++++
multi-system/src/main/java/com/gkhy/exam/system/service/ProductItemService.java | 19 +++
multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java | 63 ++++++++++
8 files changed, 329 insertions(+), 1 deletions(-)
diff --git a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java
index 8d7905e..2f6dde6 100644
--- a/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java
+++ b/multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/QualityController.java
@@ -3,6 +3,7 @@
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.system.domain.*;
import com.gkhy.exam.system.domain.req.*;
+import com.gkhy.exam.system.domain.vo.CatalogueVo;
import com.gkhy.exam.system.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -10,6 +11,8 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
@Api(tags = "企业质量目标管理")
@RestController
@@ -30,6 +33,9 @@
@Autowired
private CatalogueService catalogueService;
+
+ @Autowired
+ private ProductItemService productItemService;
/**
@@ -218,6 +224,17 @@
}
/**
+ * 目录复制
+ * @param catalogue
+ * @return
+ */
+ @ApiOperation(value = "目录复制")
+ @PostMapping("/catalogue/copy")
+ public CommonResult copyCatalogue(@RequestBody List<CatalogueVo> catalogue){
+ return catalogueService.copyCatalogue(catalogue);
+ }
+
+ /**
* 质量管理体系运行修改
* @param catalogue
* @return
@@ -332,5 +349,51 @@
}
+ /**
+ * 产品与项目列表
+ * @param productItem
+ * @return
+ */
+ @ApiOperation(value = "产品与项目列表")
+ @GetMapping("/productItem/list")
+ public CommonResult listProductItem(ProductItem productItem){
+ return CommonResult.success(productItemService.selectProductItem(productItem));
+ }
+
+
+ /**
+ * 产品与项目新增
+ * @param productItem
+ * @return
+ */
+ @ApiOperation(value = "产品与项目新增")
+ @PostMapping("/productItem/insert")
+ public CommonResult insertProductItem(@RequestBody ProductItem productItem){
+ return productItemService.insertProductItem(productItem);
+ }
+
+ /**
+ * 产品与项目修改
+ * @param productItem
+ * @return
+ */
+ @ApiOperation(value = "产品与项目修改")
+ @PostMapping("/productItem/update")
+ public CommonResult updateProductItem(@RequestBody ProductItem productItem){
+ return productItemService.updateProductItem(productItem);
+ }
+
+ /**
+ * 产品与项目删除
+ * @param itemId
+ * @return
+ */
+ @ApiOperation(value = "产品与项目删除")
+ @GetMapping("/productItem/deleted")
+ public CommonResult deletedProductItem(@RequestParam("itemId") Integer itemId){
+ return productItemService.deletedProductItem(itemId);
+ }
+
+
}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java b/multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java
new file mode 100644
index 0000000..69d1714
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/domain/ProductItem.java
@@ -0,0 +1,93 @@
+package com.gkhy.exam.system.domain;
+
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+@Data
+@TableName("product_item")
+@ApiModel(value = "ProductItem对象", description = "产品类和项目类")
+public class ProductItem implements Serializable {
+
+
+ @ApiModelProperty("主键")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @TableField("catalogue_id")
+ private Integer catalogueId;
+ @TableField(exist = false)
+ private String catalogueName;
+
+ @TableField("company_id")
+ private Integer companyId;
+ @TableField(exist = false)
+ private String companyName;
+
+ @ApiModelProperty(value = "文件编号")
+ @TableField("number")
+ private String number;
+
+ @ApiModelProperty(value = "编写指南")
+ @TableField("erdact")
+ private String erdact;
+
+ @ApiModelProperty(value = "数据类型 1产品 2项目")
+ @TableField("type")
+ private Integer type;
+
+ @ApiModelProperty(value = "文件名称")
+ @TableField("file_name")
+ private String fileName;
+
+ @ApiModelProperty(value = "文件路径")
+ @TableField("file_path")
+ private String filePath;
+
+ @TableField("del_flag")
+ private Integer delFlag;
+
+ @TableField("create_by")
+ private String createBy;
+
+ @TableField("create_time")
+ private LocalDateTime createTime;
+
+ @TableField("update_by")
+ private String updateBy;
+
+ @TableField("update_time")
+ private LocalDateTime updateTime;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/mapper/ProductItemMapper.java b/multi-system/src/main/java/com/gkhy/exam/system/mapper/ProductItemMapper.java
new file mode 100644
index 0000000..76b3574
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/mapper/ProductItemMapper.java
@@ -0,0 +1,15 @@
+package com.gkhy.exam.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gkhy.exam.system.domain.ProductItem;
+import org.apache.ibatis.annotations.Param;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface ProductItemMapper extends BaseMapper<ProductItem> {
+ List<ProductItem> selectProductItemList(ProductItem productItem);
+
+ void deletedByCompanyId(@Param("companyId") Integer companyId, @Param("type") Integer type);
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/ProductItemService.java b/multi-system/src/main/java/com/gkhy/exam/system/service/ProductItemService.java
new file mode 100644
index 0000000..aafd4d1
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/ProductItemService.java
@@ -0,0 +1,19 @@
+package com.gkhy.exam.system.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gkhy.exam.common.api.CommonPage;
+import com.gkhy.exam.common.api.CommonResult;
+import com.gkhy.exam.system.domain.ProductItem;
+
+import java.util.List;
+
+public interface ProductItemService extends IService<ProductItem> {
+ CommonPage selectProductItem(ProductItem productItem);
+
+ CommonResult insertProductItem(ProductItem productItem);
+
+ CommonResult updateProductItem(ProductItem productItem);
+
+ CommonResult deletedProductItem(Integer itemId);
+
+}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/CatalogueServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/CatalogueServiceImpl.java
index 616fe49..63895a3 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/CatalogueServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/CatalogueServiceImpl.java
@@ -13,6 +13,7 @@
import com.gkhy.exam.system.domain.vo.CatalogueVo;
import com.gkhy.exam.system.mapper.CatalogueMapper;
import com.gkhy.exam.system.mapper.CompanyIndustryTemplateMapper;
+import com.gkhy.exam.system.mapper.ProductItemMapper;
import com.gkhy.exam.system.mapper.SysCompanyMapper;
import com.gkhy.exam.system.service.CatalogueService;
import com.gkhy.exam.system.service.SysCompanyService;
@@ -34,6 +35,8 @@
private SysCompanyMapper sysCompanyMapper;
@Autowired
private CompanyIndustryTemplateMapper companyIndustryTemplateMapper;
+ @Autowired
+ private ProductItemMapper productItemMapper;
/**
* 目录管理
@@ -243,7 +246,8 @@
@Override
public CommonResult copyCatalogue(List<CatalogueVo> catalogue) {
Integer companyId = catalogue.get(0).getCompanyId();
- catalogueMapper.delete(Wrappers.<Catalogue>lambdaQuery().eq(Catalogue::getCompanyId,companyId));
+ Integer type = catalogue.get(0).getType();
+ catalogueMapper.delete(Wrappers.<Catalogue>lambdaQuery().eq(Catalogue::getCompanyId,companyId).eq(Catalogue::getType,catalogue.get(0).getType()));
for (CatalogueVo catalogueVo : catalogue) {
Catalogue catalogue1 = new Catalogue();
BeanUtils.copyProperties(catalogueVo,catalogue1);
@@ -253,6 +257,7 @@
saveCatalogue(children,catalogue1);
}
}
+ productItemMapper.deletedByCompanyId(companyId,type);
return CommonResult.success();
}
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java
new file mode 100644
index 0000000..eaf3996
--- /dev/null
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ProductItemServiceImpl.java
@@ -0,0 +1,62 @@
+package com.gkhy.exam.system.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gkhy.exam.common.api.CommonPage;
+import com.gkhy.exam.common.api.CommonResult;
+import com.gkhy.exam.common.exception.ApiException;
+import com.gkhy.exam.common.utils.PageUtils;
+import com.gkhy.exam.common.utils.SecurityUtils;
+import com.gkhy.exam.system.domain.ProductItem;
+import com.gkhy.exam.system.mapper.ProductItemMapper;
+import com.gkhy.exam.system.service.ProductItemService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Service
+public class ProductItemServiceImpl extends ServiceImpl<ProductItemMapper, ProductItem> implements ProductItemService {
+
+ @Autowired
+ private ProductItemMapper productItemMapper;
+
+ @Override
+ public CommonPage selectProductItem(ProductItem productItem) {
+ if (!SecurityUtils.adminUser()){
+ if (productItem.getCompanyId()==null){
+ throw new ApiException("非管理员操作,企业id不可为空");
+ }
+ }
+ PageUtils.startPage();
+ List<ProductItem> productItems = productItemMapper.selectProductItemList(productItem);
+ return CommonPage.restPage(productItems);
+ }
+
+ @Override
+ public CommonResult insertProductItem(ProductItem productItem) {
+ productItem.setCreateTime(LocalDateTime.now());
+ productItem.setCreateBy(SecurityUtils.getUsername());
+ productItemMapper.insert(productItem);
+ return CommonResult.success();
+ }
+
+ @Override
+ public CommonResult updateProductItem(ProductItem productItem) {
+ productItem.setUpdateBy(SecurityUtils.getUsername());
+ productItem.setUpdateTime(LocalDateTime.now());
+ productItemMapper.updateById(productItem);
+ return CommonResult.success();
+ }
+
+ @Override
+ public CommonResult deletedProductItem(Integer itemId) {
+ ProductItem productItem = new ProductItem();
+ productItem.setId(itemId);
+ productItem.setUpdateTime(LocalDateTime.now());
+ productItem.setUpdateBy(SecurityUtils.getUsername());
+ productItem.setDelFlag(2);
+ productItemMapper.updateById(productItem);
+ return CommonResult.success();
+ }
+}
diff --git a/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml b/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml
index 5106e1c..cf76a5c 100644
--- a/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml
+++ b/multi-system/src/main/resources/mapper/system/CompanyIndustryTemplateMapper.xml
@@ -89,6 +89,9 @@
<if test="type!=null and type!=''">
and ci.type like concat('%',#{type},'%')
</if>
+ <if test="templateName!=null and templateName!=''">
+ and ci.`template_name` like concat('%',#{templateName},'%')
+ </if>
ORDER BY
CAST(SUBSTRING_INDEX(ci.chapter, '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(ci.chapter, '.', 2), '.', -1) AS UNSIGNED) ASC, -- 第二级
diff --git a/multi-system/src/main/resources/mapper/system/ProductItemMapper.xml b/multi-system/src/main/resources/mapper/system/ProductItemMapper.xml
new file mode 100644
index 0000000..a8f39a9
--- /dev/null
+++ b/multi-system/src/main/resources/mapper/system/ProductItemMapper.xml
@@ -0,0 +1,68 @@
+<?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="com.gkhy.exam.system.mapper.ProductItemMapper">
+ <update id="deletedByCompanyId">
+ update product_item SET del_flag =2 where company_id = #{companyId} and type = #{type}
+ </update>
+
+ <select id="selectProductItemList" resultType="com.gkhy.exam.system.domain.ProductItem">
+ SELECT
+ pi.`id`,
+ pi.`catalogue_id`,
+ CONCAT(c.`number`, ' ', c.`mess`) AS catalogue_name,
+ pi.`company_id`,
+ sc.`name` as company_name,
+ pi.`number`,
+ pi.`erdact`,
+ pi.`type`,
+ pi.`file_name`,
+ pi.`file_path`,
+ pi.`del_flag`,
+ pi.`create_by`,
+ pi.`create_time`,
+ pi.`update_by`,
+ pi.`update_time`
+ FROM
+ product_item pi
+ LEFT JOIN sys_company sc on pi.company_id = sc.id
+ left join catalogue c on pi.catalogue_id = c.id
+ WHERE
+ pi.del_flag = 1 and pi.type = #{type}
+ <if test="companyId!=null and companyId!=''">
+ and pi.company_id =#{companyId}
+ </if>
+ <if test="catalogueId!=null and catalogueId!=''">
+ and pi.catalogue_id = #{catalogueId}
+ </if>
+ ORDER BY
+ pi.create_time ASC
+ </select>
+ <select id="writeProduct" resultType="com.gkhy.exam.system.domain.ProductItem">
+ SELECT
+ pi.`id`,
+ pi.`catalogue_id`,
+ c.`mess` as catalogue_name,
+ pi.`company_id`,
+ sc.`name` as company_name,
+ pi.`number`,
+ pi.`erdact`,
+ pi.`file_name`,
+ pi.`file_path`,
+ pi.`del_flag`,
+ pi.`create_by`,
+ pi.`create_time`,
+ pi.`update_by`,
+ pi.`update_time`
+ FROM
+ product_item pi
+ LEFT JOIN sys_company sc on pi.company_id = sc.id
+ left join catalogue c on pi.catalogue_id = c.id
+ WHERE
+ pi.del_flag = 1 and pi.company_id = #{companyId} and pi.catalogue_id in
+ (<foreach collection="catalogueIds" item="catalogueId" separator=",">
+ #{catalogueId}
+ </foreach>)
+ ORDER BY
+ pi.create_time ASC
+ </select>
+</mapper>
--
Gitblit v1.9.2