“djh”
2025-10-30 4e05db79b1d981677b8a2664f252dfccf95ef6ce
修改
已添加6个文件
已修改8个文件
636 ■■■■■ 文件已修改
multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/InternalAuditCheckController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/InternalAuditCheck.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/InternalAuditCheckCatalogue.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/InternalAuditCheckContent.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/req/CatalogueReq.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/mapper/InternalAuditCheckCatalogueMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/mapper/InternalAuditCheckContentMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/mapper/InternalAuditCheckMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/InternalAuditCheckService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCheckServiceImpl.java 280 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/CatalogueMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/InternalAuditCheckCatalogueMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/InternalAuditCheckContentMapper.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/InternalAuditCheckMapper.xml 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-admin/src/main/java/com/gkhy/exam/admin/controller/web/InternalAuditCheckController.java
@@ -3,6 +3,7 @@
import com.gkhy.exam.common.annotation.RepeatSubmit;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.system.domain.InternalAuditCheck;
import com.gkhy.exam.system.domain.Meetings;
import com.gkhy.exam.system.domain.vo.InternalAuditCheckVo;
import com.gkhy.exam.system.service.InternalAuditCheckService;
@@ -44,13 +45,13 @@
    @RepeatSubmit
    @ApiOperation(value = "新增内审检查")
    @PostMapping("/saveInternalAuditCheck")
    public CommonResult insertInternalAuditCheck(@RequestBody @Validated InternalAuditCheckVo internalAuditCheckVo){
        return internalAuditCheckService.insertInternalAuditCheck(internalAuditCheckVo);
    public CommonResult insertInternalAuditCheck(@RequestBody @Validated InternalAuditCheck internalAuditCheck){
        return internalAuditCheckService.insertInternalAuditCheck(internalAuditCheck);
    }
    @ApiOperation(value = "修改内审检查")
    @PostMapping("/updateInternalAuditCheck")
    public CommonResult updateInternalAuditCheck(@RequestBody @Validated InternalAuditCheckVo internalAuditCheckVo){
        return internalAuditCheckService.updateInternalAuditCheck(internalAuditCheckVo);
    public CommonResult updateInternalAuditCheck(@RequestBody @Validated InternalAuditCheck internalAuditCheck){
        return internalAuditCheckService.updateInternalAuditCheck(internalAuditCheck);
    }
    @ApiOperation(value = "删除内审检查")
    @ApiImplicitParams({
@@ -61,12 +62,12 @@
        return internalAuditCheckService.deletedInternalAuditCheck(id);
    }
    @ApiOperation(value = "内审检查详情")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "id", dataType = "int", required = true, value = "id"),
    })
    @GetMapping("/internalAuditCheckInfo")
    public CommonResult internalAuditCheckInfo(@RequestParam Integer id){
        return internalAuditCheckService.internalAuditCheckInfo(id);
    }
//    @ApiOperation(value = "内审检查详情")
//    @ApiImplicitParams({
//            @ApiImplicitParam(paramType = "query", name = "id", dataType = "int", required = true, value = "id"),
//    })
//    @GetMapping("/internalAuditCheckInfo")
//    public CommonResult internalAuditCheckInfo(@RequestParam Integer id){
//        return internalAuditCheckService.internalAuditCheckInfo(id);
//    }
}
multi-system/src/main/java/com/gkhy/exam/system/domain/InternalAuditCheck.java
@@ -5,7 +5,11 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@@ -31,46 +35,31 @@
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private Integer id;
    @ApiModelProperty("企业id")
    @TableField("company_id")
    @NotNull(message = "企业id不能为空")
    private Integer companyId;
    @ApiModelProperty("受审部门")
    @TableField("dept_id")
    @NotNull(message = "受审部门不能为空")
    private Long deptId;
    private Integer deptId;
    @ApiModelProperty("内审人员")
    @TableField("audit_id")
    @NotNull(message = "内审人员不能为空")
    private Long auditId;
    @TableField(exist = false)
    private String deptName;
    @ApiModelProperty("内审日期")
    @NotNull(message = "内审日期不能为空")
    @TableField("audit_date")
    private LocalDateTime auditDate;
    @ApiModelProperty("审核人员")
    @TableField("person_id")
    private Integer personId;
    @ApiModelProperty("条款编码")
    @TableField("caluse_num")
    private String caluseNum;
    @TableField(exist = false)
    private String personName;
    @ApiModelProperty("条款内容")
    @TableField("caluse_content")
    private String caluseContent;
    @ApiModelProperty("审核时间")
    @TableField("check_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime checkTime;
    @ApiModelProperty("检查记录")
    @TableField("check_record")
    @NotBlank(message = "检查记录不能为空")
    private String checkRecord;
    @ApiModelProperty("不符合标记")
    @TableField("inconsistent")
    private String inconsistent;
    @ApiModelProperty("0否1是")
    @TableField("del_flag")
    private Integer delFlag;
@@ -86,9 +75,7 @@
    @TableField("update_time")
    private LocalDateTime updateTime;
    @ApiModelProperty("部门名称")
    @TableField(exist = false)
    private String deptName;
    private List<InternalAuditCheckCatalogue> checkCatalogues;
}
multi-system/src/main/java/com/gkhy/exam/system/domain/InternalAuditCheckCatalogue.java
对比新文件
@@ -0,0 +1,47 @@
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.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.List;
@Getter
@Setter
@TableName("InternalAuditCheckCatalogue")
@ApiModel(value = "internalAuditCheckCatalogue对象", description = "内审检查标准款项")
public class InternalAuditCheckCatalogue implements Serializable {
    @ApiModelProperty("主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("主表id")
    @TableField("check_id")
    private Integer checkId;
    @ApiModelProperty("标准款项")
    @TableField("catalogue_id")
    private Integer catalogueId;
    @TableField(exist = false)
    private String number;
    @TableField(exist = false)
    private String mess;
    @TableField("del_flag")
    private Integer delFlag;
    @TableField(exist = false)
    private List<InternalAuditCheckContent> checkContents;
}
multi-system/src/main/java/com/gkhy/exam/system/domain/InternalAuditCheckContent.java
对比新文件
@@ -0,0 +1,45 @@
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.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
@TableName("internal_audit_check_content")
@ApiModel(value = "InternalAuditCheckContent对象", description = "内审检查主要内容")
public class InternalAuditCheckContent implements Serializable {
    @ApiModelProperty("主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("主表id")
    @TableField("check_catalogue_id")
    private Integer checkCatalogueId;
    @ApiModelProperty("审核要点")
    @TableField("point_key")
    private String pointKey;
    @ApiModelProperty("审核发现")
    @TableField("find")
    private String find;
    @ApiModelProperty("审核结果 1符合 2轻微不符合  3严重不符合")
    @TableField("result")
    private Integer result;
    @TableField("del_flag")
    private Integer delFlag;
}
multi-system/src/main/java/com/gkhy/exam/system/domain/req/CatalogueReq.java
@@ -8,4 +8,5 @@
    private String mess;
    private Integer catalogueId;
    private Integer companyId;
    private Integer number;
}
multi-system/src/main/java/com/gkhy/exam/system/mapper/InternalAuditCheckCatalogueMapper.java
对比新文件
@@ -0,0 +1,18 @@
package com.gkhy.exam.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.system.domain.InternalAuditCheckCatalogue;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;
import java.util.List;
@Mapper
public interface InternalAuditCheckCatalogueMapper extends BaseMapper<InternalAuditCheckCatalogue> {
    List<InternalAuditCheckCatalogue> selectByCheckIds(List<Integer> checkIds);
    int insertBatch(@Param("catalogues") List<InternalAuditCheckCatalogue> catalogues);
    int updatebyCheckId(@Param("id") Integer id);
}
multi-system/src/main/java/com/gkhy/exam/system/mapper/InternalAuditCheckContentMapper.java
对比新文件
@@ -0,0 +1,18 @@
package com.gkhy.exam.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.system.domain.InternalAuditCheckCatalogue;
import com.gkhy.exam.system.domain.InternalAuditCheckContent;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;
import java.util.List;
@Mapper
public interface InternalAuditCheckContentMapper extends BaseMapper<InternalAuditCheckContent> {
    List<InternalAuditCheckContent> selectByCatalogueIds(List<Integer> catalogueIds);
    int insertBatchs(List<InternalAuditCheckContent> checkCatalogues);
}
multi-system/src/main/java/com/gkhy/exam/system/mapper/InternalAuditCheckMapper.java
@@ -2,7 +2,9 @@
import com.gkhy.exam.system.domain.InternalAuditCheck;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.system.domain.InternalAuditCheckCatalogue;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -16,6 +18,7 @@
 */
@Mapper
public interface InternalAuditCheckMapper extends BaseMapper<InternalAuditCheck> {
    List<InternalAuditCheck> selectInternalAuditCheckList(Integer companyId);
    List<InternalAuditCheck> selectInternalAuditCheckList(@Param("companyId") Integer companyId);
}
multi-system/src/main/java/com/gkhy/exam/system/service/InternalAuditCheckService.java
@@ -18,11 +18,11 @@
public interface InternalAuditCheckService extends IService<InternalAuditCheck> {
    CommonPage selectInternalAuditCheckList(Integer companyId);
    CommonResult insertInternalAuditCheck(InternalAuditCheckVo internalAuditCheck);
    CommonResult insertInternalAuditCheck(InternalAuditCheck internalAuditCheck);
    CommonResult updateInternalAuditCheck(InternalAuditCheckVo internalAuditCheck);
    CommonResult updateInternalAuditCheck(InternalAuditCheck internalAuditCheck);
    CommonResult deletedInternalAuditCheck(Integer id);
    CommonResult internalAuditCheckInfo(Integer id);
//    CommonResult internalAuditCheckInfo(Integer id);
}
multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCheckServiceImpl.java
@@ -10,21 +10,23 @@
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.InternalAuditCheck;
import com.gkhy.exam.system.domain.InternalAuditCheckCatalogue;
import com.gkhy.exam.system.domain.InternalAuditCheckContent;
import com.gkhy.exam.system.domain.InternalAuditCheckPerson;
import com.gkhy.exam.system.domain.vo.InternalAuditCheckVo;
import com.gkhy.exam.system.mapper.InternalAuditCheckMapper;
import com.gkhy.exam.system.mapper.InternalAuditCheckPersonMapper;
import com.gkhy.exam.system.mapper.SysDeptMapper;
import com.gkhy.exam.system.mapper.SysUserMapper;
import com.gkhy.exam.system.mapper.*;
import com.gkhy.exam.system.service.InternalAuditCheckService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
@@ -41,8 +43,13 @@
    @Autowired
    private InternalAuditCheckMapper internalAuditCheckMapper;
    @Autowired
    private InternalAuditCheckPersonMapper internalAuditCheckPersonMapper;
    private InternalAuditCheckCatalogueMapper checkCatalogueMapper;
    @Autowired
    private InternalAuditCheckContentMapper checkContentMapper;
    @Autowired
    private SysUserMapper sysUserMapper;
    @Autowired
@@ -51,153 +58,154 @@
    public CommonPage selectInternalAuditCheckList(Integer companyId) {
        PageUtils.startPage();
        List<InternalAuditCheck> internalAuditChecks = internalAuditCheckMapper.selectInternalAuditCheckList(companyId);
        if (!CollectionUtils.isEmpty(internalAuditChecks)) {
            batchLoadCheckDetails(internalAuditChecks);
        }
        return CommonPage.restPage(internalAuditChecks);
    }
    private void batchLoadCheckDetails(List<InternalAuditCheck> checks) {
        //收集所有检查ID
        List<Integer> checkIds = checks.stream()
                .map(InternalAuditCheck::getId)
                .collect(Collectors.toList());
        //批量查询所有目录
        List<InternalAuditCheckCatalogue> allCatalogues = checkCatalogueMapper.selectByCheckIds(checkIds);
        if (CollectionUtils.isEmpty(allCatalogues)) {
            return;
        }
        //收集所有目录ID
        List<Integer> catalogueIds = allCatalogues.stream()
                .map(InternalAuditCheckCatalogue::getId)
                .collect(Collectors.toList());
        //批量查询所有内容
        List<InternalAuditCheckContent> allContents = checkContentMapper.selectByCatalogueIds(catalogueIds);
        //按目录ID分组内容
        Map<Integer, List<InternalAuditCheckContent>> contentMap = allContents.stream()
                .collect(Collectors.groupingBy(InternalAuditCheckContent::getCheckCatalogueId));
        //按检查ID分组目录
        Map<Integer, List<InternalAuditCheckCatalogue>> catalogueMap = allCatalogues.stream()
                .collect(Collectors.groupingBy(InternalAuditCheckCatalogue::getCheckId));
        //组装数据
        for (InternalAuditCheck check : checks) {
            List<InternalAuditCheckCatalogue> catalogues = catalogueMap.get(check.getId());
            if (!CollectionUtils.isEmpty(catalogues)) {
                for (InternalAuditCheckCatalogue catalogue : catalogues) {
                    List<InternalAuditCheckContent> contents = contentMap.get(catalogue.getId());
                    catalogue.setCheckContents(contents != null ? contents : new ArrayList<>());
                }
                check.setCheckCatalogues(catalogues);
            }
        }
    }
    @Override
    @Transactional
    public CommonResult insertInternalAuditCheck(InternalAuditCheckVo internalAuditCheck) {
        InternalAuditCheck internalAuditCheck1 = new InternalAuditCheck();
        BeanUtils.copyProperties(internalAuditCheck,internalAuditCheck1);
        internalAuditCheck1.setCreateTime(LocalDateTime.now());
        internalAuditCheck1.setCreateBy(SecurityUtils.getUsername());
    public CommonResult insertInternalAuditCheck(InternalAuditCheck internalAuditCheck) {
        internalAuditCheck.setCreateBy(SecurityUtils.getUsername());
        internalAuditCheck.setCreateTime(LocalDateTime.now());
        int insert = internalAuditCheckMapper.insert(internalAuditCheck);
        if (insert <= 0) {
            return CommonResult.failed("新增内审检查失败");
        }
        //处理目录和内容的插入
        List<InternalAuditCheckCatalogue> checkCatalogues = internalAuditCheck.getCheckCatalogues();
        if (CollectionUtils.isEmpty(checkCatalogues)) {
            return CommonResult.success();
        }
        //批量处理目录和内容
        batchInsertCataloguesAndContents(internalAuditCheck.getId(), checkCatalogues);
        return CommonResult.success();
        int insert = internalAuditCheckMapper.insert(internalAuditCheck1);
        if (insert > 0) {
            if (ObjectUtil.isNotEmpty(internalAuditCheck.getInternalAuditCheckPeople())){
                batchInsert(internalAuditCheck.getInternalAuditCheckPeople(),internalAuditCheck1.getId());
    }
    private void batchInsertCataloguesAndContents(Integer checkId, List<InternalAuditCheckCatalogue> catalogues) {
        // 1. 设置目录的检查ID并批量插入
        for (InternalAuditCheckCatalogue catalogue : catalogues) {
            catalogue.setCheckId(checkId);
        }
        // 批量插入目录
        int catalogueInsertCount = checkCatalogueMapper.insertBatch(catalogues);
        if (catalogueInsertCount != catalogues.size()) {
            throw new RuntimeException("插入目录记录数量不匹配");
        }
        // 2. 收集所有内容并设置目录ID
        List<InternalAuditCheckContent> allContents = new ArrayList<>();
        for (int i = 0; i < catalogues.size(); i++) {
            InternalAuditCheckCatalogue catalogue = catalogues.get(i);
            List<InternalAuditCheckContent> contents = catalogue.getCheckContents();
            if (!CollectionUtils.isEmpty(contents)) {
                for (InternalAuditCheckContent content : contents) {
                    content.setCheckCatalogueId(catalogue.getId());
                }
                allContents.addAll(contents);
            }
        }
        // 3. 批量插入内容
        if (!CollectionUtils.isEmpty(allContents)) {
            int contentInsertCount = checkContentMapper.insertBatchs(allContents);
            if (contentInsertCount != allContents.size()) {
                throw new RuntimeException("插入内容记录数量不匹配");
            }
        }
    }
    @Override
    public CommonResult updateInternalAuditCheck(InternalAuditCheck internalAuditCheck) {
        internalAuditCheck.setUpdateBy(SecurityUtils.getUsername());
        internalAuditCheck.setUpdateTime(LocalDateTime.now());
        int update = internalAuditCheckMapper.updateById(internalAuditCheck);
        if (update>0){
            checkCatalogueMapper.updatebyCheckId(internalAuditCheck.getId());
            List<InternalAuditCheckCatalogue> checkCatalogues = internalAuditCheck.getCheckCatalogues();
            if (CollectionUtils.isEmpty(checkCatalogues)) {
                return CommonResult.success();
            }
            batchInsertCataloguesAndContents(internalAuditCheck.getId(), checkCatalogues);
            return CommonResult.success();
        }
        return CommonResult.failed();
    }
    private void batchInsert(List<InternalAuditCheckPerson> internalAuditCheckPeople,Long auditId) {
        internalAuditCheckPeople.forEach(e -> {
            e.setAuditId(auditId);
            e.setCreateTime(LocalDateTime.now());
            e.setCreateBy(SecurityUtils.getUsername());
        });
        internalAuditCheckPersonMapper.batchInsert(internalAuditCheckPeople);
    }
    private void batchUpdate(List<InternalAuditCheckPerson> internalAuditCheckPeople) {
        internalAuditCheckPeople.forEach(e -> {
            e.setUpdateTime(LocalDateTime.now());
            e.setUpdateBy(SecurityUtils.getUsername());
        });
        internalAuditCheckPersonMapper.batchUpdate(internalAuditCheckPeople);
    }
    @Override
    public CommonResult updateInternalAuditCheck(InternalAuditCheckVo internalAuditCheck) {
        InternalAuditCheck internalAuditCheck1 = new InternalAuditCheck();
        BeanUtils.copyProperties(internalAuditCheck,internalAuditCheck1);
        internalAuditCheck1.setUpdateTime(LocalDateTime.now());
        internalAuditCheck1.setUpdateBy(SecurityUtils.getUsername());
        int update = internalAuditCheckMapper.updateById(internalAuditCheck1);
        if (update > 0) {
            List<InternalAuditCheckPerson> internalAuditCheckPeople = internalAuditCheck.getInternalAuditCheckPeople();
            if (ObjectUtil.isNotEmpty(internalAuditCheckPeople)){
                Set<Long> collect = internalAuditCheckPeople.stream().map(InternalAuditCheckPerson::getAuditUserId)
                        .collect(Collectors.toSet());
                if (collect.size() != internalAuditCheckPeople.size()){
                    throw new ApiException("受审人员重复");
                }
                LambdaQueryWrapper<InternalAuditCheckPerson> queryWrapper = new LambdaQueryWrapper<>();
                queryWrapper.eq(InternalAuditCheckPerson::getAuditId, internalAuditCheck.getId());
                queryWrapper.eq(InternalAuditCheckPerson::getDelFlag, 0);
                List<InternalAuditCheckPerson> internalAuditCheckPeople1 = internalAuditCheckPersonMapper.selectList(queryWrapper);
                List<Long> idsAll = internalAuditCheckPeople1.stream()
                        .map(InternalAuditCheckPerson::getId)
                        .collect(Collectors.toList());
                List<Long> idsUpdate = internalAuditCheckPeople.stream()
                        .map(InternalAuditCheckPerson::getId)
                        .filter(id -> id != null) // 过滤掉 null 值
                        .collect(Collectors.toList());
                if (!idsUpdate.isEmpty() && !idsAll.isEmpty()){
                    //不存在的删除
                    List<Long> result = idsAll.stream()
                            .filter(id -> !idsUpdate.contains(id))
                            .collect(Collectors.toList());
                    if (!result.isEmpty()){
                        batchDel(internalAuditCheck.getId(),result);
                    }
                }
                List<InternalAuditCheckPerson> withId = internalAuditCheckPeople.stream()
                        .filter(e -> e.getId() != null)
                        .collect(Collectors.toList());
                //修改的
                if (!withId.isEmpty()){
                    batchUpdate(withId);
                }
                List<InternalAuditCheckPerson> withoutId = internalAuditCheckPeople.stream()
                        .filter(e -> e.getId() == null)
                        .collect(Collectors.toList());
                //新增的
                if (!withoutId.isEmpty()){
                    batchInsert(withoutId,internalAuditCheck.getId());
                }
            }else {
                batchDel(internalAuditCheck.getId(),null);
            }
            return CommonResult.success(update);
        }
        return CommonResult.failed();
    }
    private void batchDel(Long id,List<Long> ids){
        LambdaQueryWrapper<InternalAuditCheckPerson> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(InternalAuditCheckPerson::getAuditId, id);
        if (ObjectUtil.isNotEmpty(ids)){
            queryWrapper.in(InternalAuditCheckPerson::getId, ids);
        }
        InternalAuditCheckPerson internalAuditCheckPerson = new InternalAuditCheckPerson();
        internalAuditCheckPerson.setDelFlag(1);
        internalAuditCheckPerson.setUpdateTime(LocalDateTime.now());
        internalAuditCheckPerson.setUpdateBy(SecurityUtils.getUsername());
        internalAuditCheckPersonMapper.update(internalAuditCheckPerson,queryWrapper);
    }
    @Override
    @Transactional
    public CommonResult deletedInternalAuditCheck(Integer id) {
        int delete = internalAuditCheckMapper.deleteById(id);
        LambdaQueryWrapper<InternalAuditCheckPerson> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(InternalAuditCheckPerson::getAuditId, id);
        InternalAuditCheckPerson internalAuditCheckPerson = new InternalAuditCheckPerson();
        internalAuditCheckPerson.setDelFlag(1);
        internalAuditCheckPerson.setUpdateTime(LocalDateTime.now());
        internalAuditCheckPerson.setUpdateBy(SecurityUtils.getUsername());
        internalAuditCheckPersonMapper.update(internalAuditCheckPerson,queryWrapper);
        InternalAuditCheck internalAuditCheck = new InternalAuditCheck();
        internalAuditCheck.setId(id);
        internalAuditCheck.setUpdateBy(SecurityUtils.getUsername());
        internalAuditCheck.setUpdateTime(LocalDateTime.now());
        internalAuditCheck.setDelFlag(2);
        int update = internalAuditCheckMapper.updateById(internalAuditCheck);
        return CommonResult.success();
    }
    @Override
    public CommonResult internalAuditCheckInfo(Integer id) {
        InternalAuditCheck internalAuditCheck = internalAuditCheckMapper.selectById(id);
        InternalAuditCheckVo internalAuditCheckVo = new InternalAuditCheckVo();
        BeanUtils.copyProperties(internalAuditCheck,internalAuditCheckVo);
        internalAuditCheckVo.setDeptName(sysDeptMapper.selectDeptById(internalAuditCheck.getDeptId()).getDeptName());
        internalAuditCheckVo.setAuditName(sysUserMapper.selectById(internalAuditCheck.getAuditId()).getName());
        LambdaQueryWrapper<InternalAuditCheckPerson> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(InternalAuditCheckPerson::getAuditId, id);
        queryWrapper.eq(InternalAuditCheckPerson::getDelFlag, 0);
        List<InternalAuditCheckPerson> internalAuditCheckPeople = internalAuditCheckPersonMapper.selectList(queryWrapper);
        internalAuditCheckVo.setInternalAuditCheckPeople(internalAuditCheckPeople);
        return CommonResult.success(internalAuditCheckVo);
    }
//    @Override
//    public CommonResult internalAuditCheckInfo(Integer id) {
//        InternalAuditCheck internalAuditCheck = internalAuditCheckMapper.selectById(id);
//
//        InternalAuditCheckVo internalAuditCheckVo = new InternalAuditCheckVo();
//        BeanUtils.copyProperties(internalAuditCheck,internalAuditCheckVo);
//        internalAuditCheckVo.setDeptName(sysDeptMapper.selectDeptById(internalAuditCheck.getDeptId()).getDeptName());
//        internalAuditCheckVo.setAuditName(sysUserMapper.selectById(internalAuditCheck.getAuditId()).getName());
//        LambdaQueryWrapper<InternalAuditCheckPerson> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(InternalAuditCheckPerson::getAuditId, id);
//        queryWrapper.eq(InternalAuditCheckPerson::getDelFlag, 0);
//        List<InternalAuditCheckPerson> internalAuditCheckPeople = internalAuditCheckPersonMapper.selectList(queryWrapper);
//        internalAuditCheckVo.setInternalAuditCheckPeople(internalAuditCheckPeople);
//
//        return CommonResult.success(internalAuditCheckVo);
//    }
}
multi-system/src/main/resources/mapper/system/CatalogueMapper.xml
@@ -117,6 +117,14 @@
        <if test="companyId!=null and companyId!=''">
            and company_id = #{companyId}
        </if>
        <if test="number!=null">
            and (
            CAST(SUBSTRING_INDEX(number, '.', 1) AS UNSIGNED) >= 4
            OR
            number LIKE '4.%'
            OR number = '4'
            )
        </if>
        ORDER BY
        CAST(SUBSTRING_INDEX(number, '.', 1) AS UNSIGNED) ASC,
        CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(number, '.', 2), '.', -1) AS UNSIGNED) ASC,  -- 第二级
multi-system/src/main/resources/mapper/system/InternalAuditCheckCatalogueMapper.xml
对比新文件
@@ -0,0 +1,38 @@
<?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.InternalAuditCheckCatalogueMapper">
    <insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO internal_audit_check_catalogue (
        check_id,
        catalogue_Id
        ) VALUES
        <foreach collection="catalogues" item="item" separator=",">
            (
            #{item.checkId},
            #{item.catalogueId}
            )
        </foreach>
    </insert>
    <update id="updatebyCheckId">
        update internal_audit_check_catalogue set del_flag =1 where check_id = #{id}
    </update>
    <select id="selectByCheckIds" resultType="com.gkhy.exam.system.domain.InternalAuditCheckCatalogue">
        SELECT
            iacc.`id`,
            iacc.`check_id`,
            iacc.`catalogue_id`,
            c.number,
            c.mess,
            iacc.`del_flag`
        FROM
            `internal_audit_check_catalogue` iacc
            LEFT JOIN catalogue c ON iacc.catalogue_id = c.id
        WHERE iacc.check_id IN
            <foreach collection="checkIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        AND iacc.del_flag = 0
    </select>
</mapper>
multi-system/src/main/resources/mapper/system/InternalAuditCheckContentMapper.xml
对比新文件
@@ -0,0 +1,37 @@
<?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.InternalAuditCheckContentMapper">
    <insert id="insertBatchs">
        INSERT INTO internal_audit_check_content (
        check_catalogue_id,
        point_key,
        find,
        result
        ) VALUES
        <foreach collection="list" item="item" separator=",">
            (
            #{item.checkCatalogueId},
            #{item.pointKey},
            #{item.find},
            #{item.result}
            )
        </foreach>
    </insert>
    <select id="selectByCatalogueIds" resultType="com.gkhy.exam.system.domain.InternalAuditCheckContent">
        SELECT
            `id`,
            `check_catalogue_id`,
            `point_key`,
            `find`,
            `result`,
            `del_flag`
        FROM
            `internal_audit_check_content`
        WHERE check_catalogue_id IN
            <foreach collection="catalogueIds" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        AND del_flag = 0
    </select>
</mapper>
multi-system/src/main/resources/mapper/system/InternalAuditCheckMapper.xml
@@ -2,38 +2,35 @@
<!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.InternalAuditCheckMapper">
    <resultMap id="BaseResultMap" type="com.gkhy.exam.system.domain.InternalAuditCheck">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="company_id" jdbcType="INTEGER" property="companyId" />
        <result column="dept_id" jdbcType="BIGINT" property="deptId" />
        <result column="audit_id" jdbcType="BIGINT" property="auditId" />
        <result column="audit_date" jdbcType="TIMESTAMP" property="auditDate" />
        <result column="caluse_num" jdbcType="VARCHAR" property="caluseNum" />
        <result column="caluse_content" jdbcType="VARCHAR" property="caluseContent" />
        <result column="check_record" jdbcType="VARCHAR" property="checkRecord" />
        <result column="inconsistent" jdbcType="VARCHAR" property="inconsistent" />
        <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
        <result column="create_by" jdbcType="VARCHAR" property="createBy" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
        <result column="dept_name" jdbcType="VARCHAR" property="deptName" />
    </resultMap>
    <select id="selectInternalAuditCheckList" parameterType="int" resultMap="BaseResultMap">
            select
        a.id, a.company_id, a.dept_id, b.dept_name,a.audit_id, a.audit_date, a.caluse_num, a.caluse_content, a.check_record, a.inconsistent, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time
            from internal_audit_check a
        left join sys_dept b on a.dept_id = b.dept_id
            where a.del_flag = 0
                <if test="companyId != null">
                    and a.company_id = #{companyId}
                </if>
            order by a.create_time desc
    <select id="selectInternalAuditCheckList" resultType="com.gkhy.exam.system.domain.InternalAuditCheck">
        SELECT
            iac.`id`,
            iac.`company_id`,
            iac.`dept_id`,
            sd.dept_name,
            iac.`person_id`,
            es.`name` as person_name,
            iac.`check_time`,
            iac.`del_flag`,
            iac.`create_by`,
            iac.`create_time`,
            iac.`update_by`,
            iac.`update_time`
        FROM
            `internal_audit_check` iac
                LEFT JOIN sys_dept sd ON iac.dept_id = sd.dept_id
                LEFT JOIN ex_student es on iac.person_id = es.id
        WHERE
            iac.del_flag = 0
        <if test="companyId!=null">
            and iac.company_id = #{companyId}
        </if>
        ORDER BY
            iac.create_time DESC
    </select>
    <select id="selectAuditCheckCatalogue"
            resultType="com.gkhy.exam.system.domain.InternalAuditCheckCatalogue">
    </select>
</mapper>