| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | |
| | | @Autowired |
| | | private CatalogueService catalogueService; |
| | | |
| | | @Autowired |
| | | private ProductItemService productItemService; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 目录复制 |
| | | * @param catalogue |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "目录复制") |
| | | @PostMapping("/catalogue/copy") |
| | | public CommonResult copyCatalogue(@RequestBody List<CatalogueVo> catalogue){ |
| | | return catalogueService.copyCatalogue(catalogue); |
| | | } |
| | | |
| | | /** |
| | | * 质量管理体系运行修改 |
| | | * @param catalogue |
| | | * @return |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 产品与项目列表 |
| | | * @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); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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); |
| | | } |
对比新文件 |
| | |
| | | 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); |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | private SysCompanyMapper sysCompanyMapper; |
| | | @Autowired |
| | | private CompanyIndustryTemplateMapper companyIndustryTemplateMapper; |
| | | @Autowired |
| | | private ProductItemMapper productItemMapper; |
| | | |
| | | /** |
| | | * 目录管理 |
| | |
| | | @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); |
| | |
| | | saveCatalogue(children,catalogue1); |
| | | } |
| | | } |
| | | productItemMapper.deletedByCompanyId(companyId,type); |
| | | return CommonResult.success(); |
| | | } |
| | | |
对比新文件 |
| | |
| | | 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(); |
| | | } |
| | | } |
| | |
| | | <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, -- 第二级 |
对比新文件 |
| | |
| | | <?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> |