heheng
2025-06-12 9e47ca901301d0a7af9bdfe49e9845ee07f5f456
部分功能调整
已修改15个文件
已添加18个文件
1352 ■■■■ 文件已修改
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysClauseManagementController.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysDeptController.java 133 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysMenuController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysRoleController.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysDept.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-framework/src/main/java/com/gkhy/exam/framework/web/service/SysPermissionService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/SysClauseManagement.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/SysDeptResponsibility.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/SysFunctionalDistribution.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/CaluseVO1.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/DeptDetialVo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/DeptVo.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/FunctionalDistributionVo.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptResponsibilityReqVo.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptSaveDTOReq.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysClauseManagementMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptResponsibilityMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysFunctionalDistributionMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/ISysDeptService.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/SysClauseManagementService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysClauseManagementServiceImpl.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java 256 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysMenuServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysRoleServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/SysClauseManagementMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/SysDeptMapper.xml 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/SysDeptResponsibilityMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/SysFunctionalDistributionMapper.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/SysMenuMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/SysRoleMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-system/src/main/resources/mapper/system/SysUserMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysClauseManagementController.java
对比新文件
@@ -0,0 +1,45 @@
package com.gkhy.exam.admin.controller.system;
import com.gkhy.exam.common.annotation.RepeatSubmit;
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.system.domain.SysClauseManagement;
import com.gkhy.exam.system.service.SysClauseManagementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Api(tags = "条款接口前端控制器")
@RestController
@RequestMapping("/system/clauseManagement")
public class SysClauseManagementController {
    @Autowired
    private SysClauseManagementService sysClauseManagementService;
    @RepeatSubmit
    @ApiOperation(value = "新增编辑条款")
    @PostMapping("/saveSysClauseManagement")
    public CommonResult saveSysClauseManagement(@RequestBody @Validated SysClauseManagement clauseManagement){
        return CommonResult.success(sysClauseManagementService.saveSysClauseManagement(clauseManagement));
    }
    @ApiOperation(value = "获取条款")
    @GetMapping("/getSysClauseManagements")
    public CommonResult getSysClauseManagements(){
        return CommonResult.success(sysClauseManagementService.getSysClauseManagements());
    }
    @ApiOperation(value = "删除条款")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", name = "id", dataType = "long", required = true, value = "id"),
    })
    @PostMapping("/delSysClauseManagement")
    public CommonResult delSysClauseManagement(@RequestParam(value = "id",required = true) Long id) {
        return CommonResult.success(sysClauseManagementService.delSysClauseManagement(id));
    }
}
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysDeptController.java
@@ -5,6 +5,11 @@
import com.gkhy.exam.common.api.CommonResult;
import com.gkhy.exam.common.constant.UserConstant;
import com.gkhy.exam.common.domain.entity.SysDept;
import com.gkhy.exam.system.domain.SysFunctionalDistribution;
import com.gkhy.exam.system.domain.vo.DeptVo;
import com.gkhy.exam.system.domain.vo.FunctionalDistributionVo;
import com.gkhy.exam.system.domain.vo.SysDeptResponsibilityReqVo;
import com.gkhy.exam.system.domain.vo.SysDeptSaveDTOReq;
import com.gkhy.exam.system.service.ISysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -34,15 +39,17 @@
    @Autowired
    private ISysDeptService deptService;
    /**
     * 获取部门列表
     */
//    @PreAuthorize("@ss.hasPermi('system:dept:list')")
//    @PreAuthorize("hasAnyAuthority('system:dept:list')")
    @GetMapping("/list")
    @ApiOperation(value = "获取部门列表")
    public CommonResult list(SysDept dept)
    {
        List<SysDept> depts = deptService.selectDeptList(dept);
        List<DeptVo> depts = deptService.selectDeptList(dept);
        return CommonResult.success(depts);
    }
@@ -52,7 +59,7 @@
    /**
     * 查询部门列表(排除节点)
     */
    @PreAuthorize("@ss.hasPermi('system:dept:list')")
    //@PreAuthorize("hasAnyAuthority('system:dept:list')")
    @GetMapping("/list/exclude/{deptId}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deptId", dataType = "Long", required = true, value = "部门id"),
@@ -60,7 +67,7 @@
    @ApiOperation(value = "查询部门列表(排除节点)")
    public CommonResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
    {
        List<SysDept> depts = deptService.selectDeptList(new SysDept());
        List<SysDept> depts = deptService.getOutDeptList(new SysDept());
        depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
        return CommonResult.success(depts);
    }
@@ -68,7 +75,7 @@
    /**
     * 根据部门编号获取详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dept:query')")
    //@PreAuthorize("hasAnyAuthority('system:dept:query')")
    @GetMapping(value = "/{deptId}")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deptId", dataType = "Long", required = true, value = "部门id"),
@@ -76,56 +83,104 @@
    @ApiOperation(value = "根据部门编号获取详细信息")
    public CommonResult getInfo(@PathVariable Long deptId)
    {
        deptService.checkDeptDataScope(deptId);
        //deptService.checkDeptDataScope(deptId);
        return  CommonResult.success(deptService.selectDeptById(deptId));
    }
    /**
     * 新增部门
     */
    @PreAuthorize("@ss.hasPermi('system:dept:add')")
    @PostMapping("/add")
    @ApiOperation(value = "新增部门业务处室")
    public CommonResult add(@Validated @RequestBody SysDept dept)
    @PostMapping("/save")
    @ApiOperation(value = "新增编辑部门")
    public CommonResult save(@Validated @RequestBody SysDeptSaveDTOReq dept)
    {
        if (!deptService.checkDeptNameUnique(dept))
        {
            return CommonResult.failed("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
        }
        dept.setCreateBy(getUsername());
        return CommonResult.success(deptService.insertDept(dept));
        return CommonResult.success(deptService.saveDept(dept));
    }
    /**
     * 修改部门
     */
    @PreAuthorize("@ss.hasPermi('system:dept:edit')")
    @ApiOperation(value = "修改部门门业务处室")
    @PutMapping
    public CommonResult edit(@Validated @RequestBody SysDept dept)
    @PostMapping("/saveResponsibility")
    @ApiOperation(value = "新增编辑部门职能")
    public CommonResult saveResponsibility(@Validated @RequestBody SysDeptResponsibilityReqVo dept)
    {
        Long deptId = dept.getDeptId();
        deptService.checkDeptDataScope(deptId);
        if (!deptService.checkDeptNameUnique(dept))
        return CommonResult.success(deptService.saveDeptResponsibility(dept));
    }
    @GetMapping("/functionalDistributionList")
    @ApiOperation(value = "职能分配数据")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "Long", required = true, value = "公司id"),
    })
    public CommonResult functionalDistributionList(@RequestParam Long companyId)
        {
            return CommonResult.failed("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
        List<SysFunctionalDistribution> functionalDistributionList = deptService.getFunctionalDistributionList(companyId);
        return CommonResult.success(functionalDistributionList);
        }
        else if (dept.getParentId().equals(deptId))
    @PostMapping("/saveFunctionalDistribution")
    @ApiOperation(value = "保存职能分配")
    public CommonResult saveFunctionalDistribution(@Validated @RequestBody FunctionalDistributionVo re)
        {
            return CommonResult.failed("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
        return CommonResult.success(deptService.saveFunctionalDistribution(re));
        }
        else if (ObjectUtil.equals(UserConstant.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
        {
            return CommonResult.failed("该部门包含未停用的子部门!");
    @GetMapping("/initFunctionalDistribution")
    @ApiOperation(value = "职能分配初始化")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "companyId", dataType = "Long", required = true, value = "公司id"),
    })
    public CommonResult initFunctionalDistribution(@RequestParam Long companyId) {
        return CommonResult.success(deptService.initFunctionalDistribution(companyId));
        }
        dept.setUpdateBy(getUsername());
        return CommonResult.success(deptService.updateDept(dept));
    }
//    /**
//     * 新增部门
//     */
//    //@PreAuthorize("hasAnyAuthority('system:dept:add')")
//    @PostMapping("/add")
//    @ApiOperation(value = "新增部门业务处室")
//    public CommonResult add(@Validated @RequestBody SysDept dept)
//    {
//        if (!deptService.checkDeptNameUnique(dept))
//        {
//            return CommonResult.failed("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
//        }
//        dept.setCreateBy(getUsername());
//        return CommonResult.success(deptService.insertDept(dept));
//    }
//
//
//
//
//    /**
//     * 修改部门
//     */
//    //@PreAuthorize("hasAnyAuthority('system:dept:edit')")
//    @ApiOperation(value = "修改部门门业务处室")
//    @PutMapping
//    public CommonResult edit(@Validated @RequestBody SysDept dept)
//    {
//        Long deptId = dept.getDeptId();
//        //deptService.checkDeptDataScope(deptId);
//        if (!deptService.checkDeptNameUnique(dept))
//        {
//            return CommonResult.failed("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
//        }
//        else if (dept.getParentId().equals(deptId))
//        {
//            return CommonResult.failed("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
//        }
//        else if (ObjectUtil.equals(UserConstant.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0)
//        {
//            return CommonResult.failed("该部门包含未停用的子部门!");
//        }
//        dept.setUpdateBy(getUsername());
//        return CommonResult.success(deptService.updateDept(dept));
//    }
    /**
     * 删除部门
     */
    @PreAuthorize("@ss.hasPermi('system:dept:remove')")
    //@PreAuthorize("hasAnyAuthority('system:dept:remove')")
    @DeleteMapping("/{deptId}")
    @ApiOperation(value = "删除部门门业务处室")
    public CommonResult remove(@PathVariable Long deptId)
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysMenuController.java
@@ -34,7 +34,7 @@
    /**
     * 获取菜单列表
     */
    @PreAuthorize("@ss.hasPermi('system:menu:list')")
    //@PreAuthorize("hasAnyAuthority('system:menu:list')")
    @GetMapping("/list")
    public CommonResult list(SysMenu menu)
    {
@@ -45,7 +45,7 @@
    /**
     * 根据菜单编号获取详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:menu:query')")
    //@PreAuthorize("hasAnyAuthority('system:menu:query')")
    @GetMapping(value = "/{menuId}")
    public CommonResult getInfo(@PathVariable Long menuId)
    {
@@ -78,7 +78,7 @@
    /**
     * 新增菜单
     */
    @PreAuthorize("@ss.hasPermi('system:menu:add')")
    //@PreAuthorize("hasAnyAuthority('system:menu:add')")
    @PostMapping
    public CommonResult add(@Validated @RequestBody SysMenu menu)
    {
@@ -97,7 +97,7 @@
    /**
     * 修改菜单
     */
    @PreAuthorize("@ss.hasPermi('system:menu:edit')")
    //@PreAuthorize("hasAnyAuthority('system:menu:edit')")
    @PutMapping
    public CommonResult edit(@Validated @RequestBody SysMenu menu)
@@ -121,7 +121,7 @@
    /**
     * 删除菜单
     */
    @PreAuthorize("@ss.hasPermi('system:menu:remove')")
    //@PreAuthorize("hasAnyAuthority('system:menu:remove')")
    @DeleteMapping("/{menuId}")
    public CommonResult remove(@PathVariable("menuId") Long menuId)
    {
multi-admin/src/main/java/com/gkhy/exam/admin/controller/system/SysRoleController.java
@@ -10,6 +10,7 @@
import com.gkhy.exam.common.domain.model.LoginUser;
import com.gkhy.exam.common.domain.model.LoginUserDetails;
import com.gkhy.exam.common.enums.BusinessType;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.framework.web.service.SysPermissionService;
import com.gkhy.exam.framework.web.service.TokenService;
import com.gkhy.exam.system.domain.SysUserRole;
@@ -53,7 +54,7 @@
//    @Autowired
//    private ISysDeptService deptService;
    @PreAuthorize("@ss.hasPermi('system:role:list')")
    // @PreAuthorize("hasAnyAuthority('system:role:list')")
    @GetMapping("/list")
    public CommonResult list(SysRole role)
    {
@@ -62,7 +63,7 @@
    }
//    @Log(title = "角色管理", businessType = BusinessType.EXPORT)
//    @PreAuthorize("@ss.hasPermi('system:role:export')")
//    @PreAuthorize("hasAnyAuthority('system:role:export')")
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, SysRole role)
//    {
@@ -74,7 +75,7 @@
    /**
     * 根据角色编号获取详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:role:query')")
    //@PreAuthorize("hasAnyAuthority('system:role:query')")
    @GetMapping(value = "/{roleId}")
    public CommonResult getInfo(@PathVariable Long roleId)
    {
@@ -85,8 +86,8 @@
    /**
     * 新增角色
     */
    @PreAuthorize("@ss.hasPermi('system:role:add')")
    @Log(title = "角色管理", businessType = BusinessType.INSERT)
    //@PreAuthorize("hasAnyAuthority('system:role:add')")
    //@Log(title = "角色管理", businessType = BusinessType.INSERT)
    @PostMapping
    public CommonResult add(@Validated @RequestBody SysRole role)
    {
@@ -106,8 +107,8 @@
    /**
     * 修改保存角色
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.UPDATE)
    //@PreAuthorize("hasAnyAuthority('system:role:edit')")
    //@Log(title = "角色管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public CommonResult edit(@Validated @RequestBody SysRole role)
    {
@@ -128,7 +129,7 @@
            // 更新缓存用户权限
            LoginUserDetails loginUser = getLoginUser();
            if (ObjectUtil.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
            if (ObjectUtil.isNotNull(loginUser.getUser()) && !SecurityUtils.isAdmin(loginUser.getUser().getId()))
            {
                loginUser.setUser(userService.selectUserByUsername(loginUser.getUser().getName()));
                loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
@@ -142,8 +143,8 @@
    /**
     * 修改保存数据权限
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.UPDATE)
    //@PreAuthorize("hasAnyAuthority('system:role:edit')")
    //@Log(title = "角色管理", businessType = BusinessType.UPDATE)
    @PutMapping("/dataScope")
    public CommonResult dataScope(@RequestBody SysRole role)
    {
@@ -155,8 +156,8 @@
    /**
     * 状态修改
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.UPDATE)
    //@PreAuthorize("hasAnyAuthority('system:role:edit')")
    // @Log(title = "角色管理", businessType = BusinessType.UPDATE)
    @PutMapping("/changeStatus")
    public CommonResult changeStatus(@RequestBody SysRole role)
    {
@@ -169,7 +170,7 @@
    /**
     * 删除角色
     */
    @PreAuthorize("@ss.hasPermi('system:role:remove')")
    //@PreAuthorize("hasAnyAuthority('system:role:remove')")
    @Log(title = "角色管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{roleIds}")
    public CommonResult remove(@PathVariable Long[] roleIds)
@@ -180,7 +181,7 @@
    /**
     * 获取角色选择框列表
     */
    @PreAuthorize("@ss.hasPermi('system:role:query')")
    //@PreAuthorize("hasAnyAuthority('system:role:query')")
    @GetMapping("/optionselect")
    public CommonResult optionselect()
    {
@@ -190,7 +191,7 @@
    /**
     * 查询已分配用户角色列表
     */
    @PreAuthorize("@ss.hasPermi('system:role:list')")
    //@PreAuthorize("hasAnyAuthority('system:role:list')")
    @GetMapping("/authUser/allocatedList")
    public CommonResult allocatedList(SysUser user)
    {
@@ -202,7 +203,7 @@
    /**
     * 查询未分配用户角色列表
     */
    @PreAuthorize("@ss.hasPermi('system:role:list')")
    //@PreAuthorize("hasAnyAuthority('system:role:list')")
    @GetMapping("/authUser/unallocatedList")
    public CommonResult unallocatedList(SysUser user)
    {
@@ -214,7 +215,7 @@
    /**
     * 取消授权用户
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    //@PreAuthorize("hasAnyAuthority('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.GRANT)
    @PutMapping("/authUser/cancel")
    public CommonResult cancelAuthUser(@RequestBody SysUserRole userRole)
@@ -225,7 +226,7 @@
    /**
     * 批量取消授权用户
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    //@PreAuthorize("hasAnyAuthority('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.GRANT)
    @PutMapping("/authUser/cancelAll")
    public CommonResult cancelAuthUserAll(Long roleId, Long[] userIds)
@@ -236,7 +237,7 @@
    /**
     * 批量选择用户授权
     */
    @PreAuthorize("@ss.hasPermi('system:role:edit')")
    //@PreAuthorize("hasAnyAuthority('system:role:edit')")
    @Log(title = "角色管理", businessType = BusinessType.GRANT)
    @PutMapping("/authUser/selectAll")
    public CommonResult selectAuthUserAll(Long roleId, Long[] userIds)
@@ -248,7 +249,7 @@
    /**
     * 获取对应角色部门树列表
     */
    @PreAuthorize("@ss.hasPermi('system:role:query')")
    //@PreAuthorize("hasAnyAuthority('system:role:query')")
    @GetMapping(value = "/deptTree/{roleId}")
    public CommonResult deptTree(@PathVariable("roleId") Long roleId)
    {
multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysDept.java
@@ -7,9 +7,7 @@
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
@@ -19,7 +17,7 @@
 * 
 * @author expert
 */
@ApiModel(value = "SysDept对象", description = "部门业务处室")
@ApiModel(value = "SysDept对象", description = "部门")
public class SysDept extends BaseEntity
{
    private static final long serialVersionUID = 1L;
@@ -29,7 +27,7 @@
    private Long deptId;
    /** 父部门ID */
    @ApiModelProperty("父部门ID")
    @ApiModelProperty("主要负责部门ID")
    private Long parentId;
    /** 祖级列表 */
@@ -47,13 +45,11 @@
    /** 负责人 */
    @ApiModelProperty("负责人")
    private String leader;
    private Long leaderUserId;
    /** 联系电话 */
    private String phone;
    @ApiModelProperty("公司id")
    private Long companyId;
    /** 邮箱 */
    private String email;
    /** 部门状态:0正常,1停用 */
    @ApiModelProperty("部门状态:0正常,1停用")
@@ -63,8 +59,23 @@
    private String delFlag;
    /** 父部门名称 */
    @ApiModelProperty("父部门名称")
    @ApiModelProperty("主要负责部门名称")
    private String parentName;
    @ApiModelProperty("部门负责人名称")
    private String leaderName;
    @ApiModelProperty("部门人数")
    private Integer personNum;
    @ApiModelProperty("内审人员id")
    private Long internalAuditors;
    @ApiModelProperty("内审人员名称")
    private String internalAuditorsName;
    @ApiModelProperty("部门职责")
    private String responsibilities;
    
    /** 子部门 */
    private List<SysDept> children = new ArrayList<SysDept>();
@@ -111,7 +122,6 @@
        this.deptName = deptName;
    }
    @NotNull(message = "显示顺序不能为空")
    public Integer getOrderNum()
    {
        return orderNum;
@@ -122,38 +132,6 @@
        this.orderNum = orderNum;
    }
    public String getLeader()
    {
        return leader;
    }
    public void setLeader(String leader)
    {
        this.leader = leader;
    }
    @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
    public String getPhone()
    {
        return phone;
    }
    public void setPhone(String phone)
    {
        this.phone = phone;
    }
    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    public String getEmail()
    {
        return email;
    }
    public void setEmail(String email)
    {
        this.email = email;
    }
    public String getStatus()
    {
@@ -203,9 +181,6 @@
            .append("ancestors", getAncestors())
            .append("deptName", getDeptName())
            .append("orderNum", getOrderNum())
            .append("leader", getLeader())
            .append("phone", getPhone())
            .append("email", getEmail())
            .append("status", getStatus())
            .append("delFlag", getDelFlag())
            .append("createBy", getCreateBy())
@@ -214,4 +189,60 @@
            .append("updateTime", getUpdateTime())
            .toString();
    }
    public Long getLeaderUserId() {
        return leaderUserId;
    }
    public void setLeaderUserId(Long leaderUserId) {
        this.leaderUserId = leaderUserId;
    }
    public Long getCompanyId() {
        return companyId;
    }
    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }
    public Integer getPersonNum() {
        return personNum;
    }
    public void setPersonNum(Integer personNum) {
        this.personNum = personNum;
    }
    public Long getInternalAuditors() {
        return internalAuditors;
    }
    public void setInternalAuditors(Long internalAuditors) {
        this.internalAuditors = internalAuditors;
    }
    public String getResponsibilities() {
        return responsibilities;
    }
    public void setResponsibilities(String responsibilities) {
        this.responsibilities = responsibilities;
    }
    public String getLeaderName() {
        return leaderName;
    }
    public void setLeaderName(String leaderName) {
        this.leaderName = leaderName;
    }
    public String getInternalAuditorsName() {
        return internalAuditorsName;
    }
    public void setInternalAuditorsName(String internalAuditorsName) {
        this.internalAuditorsName = internalAuditorsName;
    }
}
multi-common/src/main/java/com/gkhy/exam/common/domain/entity/SysUser.java
@@ -13,6 +13,7 @@
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@@ -105,6 +106,30 @@
    @TableField("version")
    private Integer version;
    @ApiModelProperty("部门")
    @TableField("dept_id")
    private Long deptId;
    @ApiModelProperty("部门名称")
    @TableField(exist = false)
    private String deptName;
    @ApiModelProperty("职务")
    @TableField("duty")
    private String duty;
    @ApiModelProperty("专业")
    @TableField("post")
    private String post;
    @ApiModelProperty("身份证号")
    @TableField("id_card")
    private String idCard;
    @ApiModelProperty("入职时间")
    @TableField("entry_time")
    private LocalDate entryTime;
    @ApiModelProperty("公司名称")
    @TableField(exist = false)
    private String companyName;
@@ -120,16 +145,4 @@
    @TableField(exist = false)
    private List<SysRole> roles;
    @ApiModelProperty("是否为管理员")
    @TableField(exist = false)
    private Boolean admin;
    public boolean isAdmin()
    {
        return isAdmin(this.id);
    }
    public static boolean isAdmin(Long userId)
    {
        return userId != null && 1L == userId;
    }
}
multi-framework/src/main/java/com/gkhy/exam/framework/web/service/SysPermissionService.java
@@ -4,6 +4,7 @@
import com.gkhy.exam.common.constant.UserConstant;
import com.gkhy.exam.common.domain.entity.SysRole;
import com.gkhy.exam.common.domain.entity.SysUser;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.common.utils.StringUtils;
import com.gkhy.exam.system.service.ISysMenuService;
import com.gkhy.exam.system.service.ISysRoleService;
@@ -39,7 +40,7 @@
    {
        Set<String> roles = new HashSet<String>();
        // 管理员拥有所有权限
        if (user.isAdmin())
        if (SecurityUtils.isAdmin(user.getId()))
        {
            roles.add("admin");
        }
@@ -60,7 +61,7 @@
    {
        Set<String> perms = new HashSet<String>();
        // 管理员拥有所有权限
        if (user.isAdmin())
        if (SecurityUtils.isAdmin(user.getId()))
        {
            perms.add("*:*:*");
        }
multi-system/src/main/java/com/gkhy/exam/system/domain/SysClauseManagement.java
对比新文件
@@ -0,0 +1,27 @@
package com.gkhy.exam.system.domain;
import com.gkhy.exam.common.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ApiModel(value = "条款对象")
@Data
public class SysClauseManagement extends BaseEntity {
    @ApiModelProperty("部门Id")
    private Long id;
    @ApiModelProperty("排序")
    private Integer sort;
    @ApiModelProperty("条款编码")
    @NotBlank(message = "条款编码不能为空")
    private String clauseNum;
    /** 删除标志(0代表存在 2代表删除) */
    private String delFlag;
}
multi-system/src/main/java/com/gkhy/exam/system/domain/SysDeptResponsibility.java
对比新文件
@@ -0,0 +1,63 @@
package com.gkhy.exam.system.domain;
import com.gkhy.exam.common.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
@ApiModel(value = "部门-部门职责对象")
@Data
public class SysDeptResponsibility extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**  */
    @ApiModelProperty("主键")
    private Long id;
    @ApiModelProperty("部门ID")
    @NonNull
    private Long deptId;
    @ApiModelProperty("公司id")
    @NonNull
    private Long companyId;
    @ApiModelProperty("条款id")
    private Long clauseId;
    @ApiModelProperty("条款编码")
    @NotBlank(message = "条款编码不能为空")
    private String clauseNum;
    @ApiModelProperty("条款内容")
    @NotBlank(message = "条款内容不能为空")
    private String content;
    @ApiModelProperty("负责人")
    private String leader;
    @ApiModelProperty("相关证据材料")
    private String evidenceMaterials;
    @ApiModelProperty("现有管理类文件")
    private String managementDocuments;
    @ApiModelProperty("技术类文件")
    private String technicalDocuments;
    @ApiModelProperty("现有记录")
    private String existingRecords;
    @ApiModelProperty("1默认2新增")
    private String dataType;
    /** 删除标志(0代表存在 2代表删除) */
    private String delFlag;
    public SysDeptResponsibility() {
    }
}
multi-system/src/main/java/com/gkhy/exam/system/domain/SysFunctionalDistribution.java
对比新文件
@@ -0,0 +1,30 @@
package com.gkhy.exam.system.domain;
import com.gkhy.exam.common.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ApiModel(value = "职能分配对象")
@Data
public class SysFunctionalDistribution extends BaseEntity {
    @ApiModelProperty("部门Id")
    private Long deptId;
    @ApiModelProperty("部门名称")
    private String deptName;
    @ApiModelProperty("公司id")
    private Long companyId;
    @ApiModelProperty("条款编码")
    @NotBlank(message = "条款编码不能为空")
    private String clauseNum;
    @ApiModelProperty("是否选中0否1是")
    private Integer chooseLab;
}
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/CaluseVO1.java
对比新文件
@@ -0,0 +1,52 @@
package com.gkhy.exam.system.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CaluseVO1 {
    @ApiModelProperty(value = "数据id")
    private Long id;
    @ApiModelProperty(value = "条款id")
    private Long clauseId;
    @ApiModelProperty(value = "条款编码")
    private String clauseNum;
    @ApiModelProperty(value = "内容")
    private String content;
    public String getClauseNum() {
        return clauseNum;
    }
    public void setClauseNum(String clauseNum) {
        this.clauseNum = clauseNum;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Long getClauseId() {
        return clauseId;
    }
    public void setClauseId(Long clauseId) {
        this.clauseId = clauseId;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
}
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/DeptDetialVo.java
对比新文件
@@ -0,0 +1,22 @@
package com.gkhy.exam.system.domain.vo;
import com.gkhy.exam.common.domain.entity.SysDept;
import com.gkhy.exam.system.domain.SysDeptResponsibility;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "SysDept对象列表", description = "SysDept对象列表")
public class DeptDetialVo extends SysDept {
    @ApiModelProperty(value = "条款信息")
   private List<SysDeptResponsibility> SysDeptResponsibilitys;
    public List<SysDeptResponsibility> getSysDeptResponsibilitys() {
        return SysDeptResponsibilitys;
    }
    public void setSysDeptResponsibilitys(List<SysDeptResponsibility> sysDeptResponsibilitys) {
        SysDeptResponsibilitys = sysDeptResponsibilitys;
    }
}
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/DeptVo.java
对比新文件
@@ -0,0 +1,21 @@
package com.gkhy.exam.system.domain.vo;
import com.gkhy.exam.common.domain.entity.SysDept;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "SysDept对象列表", description = "SysDept对象列表")
public class DeptVo extends SysDept {
    @ApiModelProperty(value = "条款信息")
   private List<CaluseVO1> caluseVO1List;
    public List<CaluseVO1> getCaluseVO1List() {
        return caluseVO1List;
    }
    public void setCaluseVO1List(List<CaluseVO1> caluseVO1List) {
        this.caluseVO1List = caluseVO1List;
    }
}
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/FunctionalDistributionVo.java
对比新文件
@@ -0,0 +1,23 @@
package com.gkhy.exam.system.domain.vo;
import com.gkhy.exam.system.domain.SysFunctionalDistribution;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel(value = "职能分配对象保存")
@Data
public class FunctionalDistributionVo {
    @ApiModelProperty(value = "公司Id",  required = true)
    @NotNull
    private Long companyId;
    @ApiModelProperty(value = "数据",  required = true)
    @NotEmpty
    private List<SysFunctionalDistribution> list;
}
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptResponsibilityReqVo.java
对比新文件
@@ -0,0 +1,43 @@
package com.gkhy.exam.system.domain.vo;
import com.gkhy.exam.system.domain.SysDeptResponsibility;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel(value = "部门职责对象新增编辑")
@Data
public class SysDeptResponsibilityReqVo {
    @ApiModelProperty("主键")
    @NotNull
    private Long deptId;
    @ApiModelProperty("公司id")
    @NotNull
    private Long companyId;
    @ApiModelProperty("部门人数")
    @NotNull(message = "部门人数不能为空")
    private Integer personNum;
    @ApiModelProperty("内审人员id")
    @NotNull(message = "内审人员不能为空")
    private Long internalAuditors;
    @ApiModelProperty("部门职责")
    @NotBlank(message = "部门职责不能为空")
    private String responsibilities;
    @ApiModelProperty("部门职责列表")
    @NotEmpty(message = "部门职责列表不能为空")
    private List<SysDeptResponsibility> sysDeptResponsibilityList;
    @ApiModelProperty("删除数据")
    private List<Long> delData;
}
multi-system/src/main/java/com/gkhy/exam/system/domain/vo/SysDeptSaveDTOReq.java
对比新文件
@@ -0,0 +1,46 @@
package com.gkhy.exam.system.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value = "部门新增编辑对象", description = "部门新增编辑对象")
public class SysDeptSaveDTOReq {
    /** 部门ID */
    @ApiModelProperty("主键")
    private Long deptId;
    /** 父部门ID */
    @ApiModelProperty("主要负责部门ID无就传0")
    private Long parentId;
    /** 祖级列表 */
    @ApiModelProperty("祖级列表")
    private String ancestors;
    /** 部门名称 */
    @ApiModelProperty("部门名称")
    @NotBlank(message ="部门名称不能为空" )
    private String deptName;
    /** 负责人 */
    @ApiModelProperty("负责人")
    @NotNull(message = "负责人不能为空")
    private Long leaderUserId;
    @ApiModelProperty("公司id")
    @NotNull(message = "公司不能为空")
    private Long companyId;
    @ApiModelProperty(value = "条款信息新增编辑")
    private List<CaluseVO1> caluseVO1List;
    @ApiModelProperty(value = "删除条款id")
    private List<Long> delCaluseIds;
}
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysClauseManagementMapper.java
对比新文件
@@ -0,0 +1,15 @@
package com.gkhy.exam.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.system.domain.SysClauseManagement;
/**
 * 部门管理 数据层
 *
 * @author expert
 */
public interface SysClauseManagementMapper extends BaseMapper<SysClauseManagement> {
}
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptMapper.java
@@ -2,6 +2,7 @@
import com.gkhy.exam.common.domain.entity.SysDept;
import com.gkhy.exam.system.domain.vo.DeptVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -19,7 +20,7 @@
     * @param dept 部门信息
     * @return 部门信息集合
     */
    public List<SysDept> selectDeptList(SysDept dept);
    public List<DeptVo> selectDeptList(SysDept dept);
    /**
     *
@@ -84,7 +85,7 @@
     * @param parentId 父部门ID
     * @return 结果
     */
    public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
    public SysDept checkDeptNameUnique(@Param("companyId") Long companyId,@Param("deptName") String deptName, @Param("parentId") Long parentId);
    /**
     * 新增部门信息
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysDeptResponsibilityMapper.java
对比新文件
@@ -0,0 +1,19 @@
package com.gkhy.exam.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.common.domain.entity.SysDept;
import com.gkhy.exam.system.domain.SysDeptResponsibility;
import com.gkhy.exam.system.domain.vo.DeptVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * 部门管理 数据层
 *
 * @author expert
 */
public interface SysDeptResponsibilityMapper extends BaseMapper<SysDeptResponsibility> {
}
multi-system/src/main/java/com/gkhy/exam/system/mapper/SysFunctionalDistributionMapper.java
对比新文件
@@ -0,0 +1,22 @@
package com.gkhy.exam.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gkhy.exam.system.domain.SysFunctionalDistribution;
import java.util.List;
/**
 * 部门管理 数据层
 *
 * @author expert
 */
public interface SysFunctionalDistributionMapper extends BaseMapper<SysFunctionalDistribution> {
    List<SysFunctionalDistribution> selectListVo(Long companyId);
    int batchInsert(List<SysFunctionalDistribution> list);
    int batchUpdate(List<SysFunctionalDistribution> list);
}
multi-system/src/main/java/com/gkhy/exam/system/service/ISysDeptService.java
@@ -4,6 +4,8 @@
import com.gkhy.exam.common.domain.TreeSelect;
import com.gkhy.exam.common.domain.entity.SysDept;
import com.gkhy.exam.system.domain.SysFunctionalDistribution;
import com.gkhy.exam.system.domain.vo.*;
import java.util.List;
@@ -20,7 +22,7 @@
     * @param dept 部门信息
     * @return 部门信息集合
     */
    public List<SysDept> selectDeptList(SysDept dept);
    public List<DeptVo> selectDeptList(SysDept dept);
    List<SysDept> getOutDeptList(SysDept dept);
@@ -62,7 +64,7 @@
     * @param deptId 部门ID
     * @return 部门信息
     */
    public SysDept selectDeptById(Long deptId);
    public DeptDetialVo selectDeptById(Long deptId);
    /**
     * 根据ID查询所有子部门(正常状态)
@@ -111,6 +113,18 @@
     */
    public int insertDept(SysDept dept);
    public int saveDept(SysDeptSaveDTOReq dept);
    public int saveDeptResponsibility(SysDeptResponsibilityReqVo reqVo);
    List<SysFunctionalDistribution> getFunctionalDistributionList(Long companyId);
    int initFunctionalDistribution(Long companyId);
    int saveFunctionalDistribution(FunctionalDistributionVo reqVo);
    /**
     * 修改保存部门信息
     * 
multi-system/src/main/java/com/gkhy/exam/system/service/SysClauseManagementService.java
对比新文件
@@ -0,0 +1,14 @@
package com.gkhy.exam.system.service;
import com.gkhy.exam.system.domain.SysClauseManagement;
import java.util.List;
public interface SysClauseManagementService {
    List<SysClauseManagement> getSysClauseManagements();
    int saveSysClauseManagement(SysClauseManagement sysClauseManagement);
    int delSysClauseManagement(Long id);
}
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysClauseManagementServiceImpl.java
对比新文件
@@ -0,0 +1,67 @@
package com.gkhy.exam.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.SysClauseManagement;
import com.gkhy.exam.system.mapper.SysClauseManagementMapper;
import com.gkhy.exam.system.service.SysClauseManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
@Service
public class SysClauseManagementServiceImpl extends ServiceImpl<SysClauseManagementMapper, SysClauseManagement> implements SysClauseManagementService {
   @Autowired
   private SysClauseManagementMapper sysClauseManagementMapper;
    @Override
    public List<SysClauseManagement> getSysClauseManagements() {
        LambdaQueryWrapper<SysClauseManagement> lambdaQueryWrapper = Wrappers.<SysClauseManagement>lambdaQuery()
                .eq(SysClauseManagement::getDelFlag, "0").orderByAsc(SysClauseManagement::getClauseNum);
        return baseMapper.selectList(lambdaQueryWrapper);
    }
    @Override
    public int saveSysClauseManagement(SysClauseManagement sysClauseManagement) {
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
            throw new RuntimeException("没有权限访问!");
        }
        LambdaQueryWrapper<SysClauseManagement> lambdaQueryWrapper = Wrappers.<SysClauseManagement>lambdaQuery()
                .eq(SysClauseManagement::getDelFlag, "0").eq(SysClauseManagement::getClauseNum, sysClauseManagement.getClauseNum());
        if (sysClauseManagement.getId() == null){
            if (baseMapper.selectCount(lambdaQueryWrapper) > 0){
                throw new RuntimeException("条款编号已存在!");
            }
            sysClauseManagement.setCreateBy(SecurityUtils.getUsername());
            sysClauseManagement.setCreateTime(LocalDateTime.now());
            return sysClauseManagementMapper.insert(sysClauseManagement);
        }else {
            lambdaQueryWrapper.ne(SysClauseManagement::getId, sysClauseManagement.getId());
            if (baseMapper.selectCount(lambdaQueryWrapper) > 0){
                throw new RuntimeException("条款编号已存在!");
            }
            sysClauseManagement.setUpdateBy(SecurityUtils.getUsername());
            sysClauseManagement.setUpdateTime(LocalDateTime.now());
            return sysClauseManagementMapper.updateById(sysClauseManagement);
        }
    }
    @Override
    public int delSysClauseManagement(Long id) {
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
            throw new RuntimeException("没有权限访问!");
        }
        //todo 校验已使用的?
        SysClauseManagement sysClauseManagement = new SysClauseManagement();
        sysClauseManagement.setDelFlag("1");
        sysClauseManagementMapper.update(sysClauseManagement, Wrappers.<SysClauseManagement>lambdaQuery().eq(SysClauseManagement::getId, id));
        return 1;
    }
}
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysDeptServiceImpl.java
@@ -2,7 +2,12 @@
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.gkhy.exam.common.constant.Constants;
import com.gkhy.exam.common.constant.UserConstant;
import com.gkhy.exam.common.domain.TreeSelect;
import com.gkhy.exam.common.domain.entity.SysDept;
@@ -11,15 +16,21 @@
import com.gkhy.exam.common.exception.ApiException;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.common.utils.SpringUtils;
import com.gkhy.exam.system.domain.ExPaperStudent;
import com.gkhy.exam.system.domain.SysDeptResponsibility;
import com.gkhy.exam.system.domain.SysFunctionalDistribution;
import com.gkhy.exam.system.domain.vo.*;
import com.gkhy.exam.system.mapper.SysDeptMapper;
import com.gkhy.exam.system.mapper.SysDeptResponsibilityMapper;
import com.gkhy.exam.system.mapper.SysFunctionalDistributionMapper;
import com.gkhy.exam.system.mapper.SysRoleMapper;
import com.gkhy.exam.system.service.ISysDeptService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -36,6 +47,13 @@
    @Autowired
    private SysRoleMapper roleMapper;
    @Autowired
    private SysDeptResponsibilityMapper deptResponsibilityMapper;
    @Autowired
    private SysFunctionalDistributionMapper sysFunctionalDistributionMapper;
    public static final String[] DEPT_ROOT = {"4.1",  "4.2", "4.3", "4.4", "5.1", "5.2", "5.3","6.1", "6.2", "6.3",
            "7.1.1",  "7.1.2", "7.1.3", "7.1.4", "7.1.5", "7.1.6"};
    /**
     * 查询部门管理数据
     * 
@@ -44,7 +62,7 @@
     */
    @Override
    public List<SysDept> selectDeptList(SysDept dept)
    public List<DeptVo> selectDeptList(SysDept dept)
    {
        return deptMapper.selectDeptList(dept);
    }
@@ -63,7 +81,7 @@
    @Override
    public List<TreeSelect> selectDeptTreeList(SysDept dept)
    {
        List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
        List<SysDept> depts = SpringUtils.getAopProxy(this).getOutDeptList(dept);
        return buildDeptTreeSelect(depts);
    }
@@ -127,9 +145,19 @@
     * @return 部门信息
     */
    @Override
    public SysDept selectDeptById(Long deptId)
    public DeptDetialVo selectDeptById(Long deptId)
    {
        return deptMapper.selectDeptById(deptId);
        SysDept sysDept = deptMapper.selectDeptById(deptId);
        DeptDetialVo deptDetialVo = new DeptDetialVo();
        BeanUtils.copyProperties(sysDept, deptDetialVo);
        LambdaQueryWrapper<SysDeptResponsibility> lambdaQueryWrapper = Wrappers.<SysDeptResponsibility>lambdaQuery()
                .eq(SysDeptResponsibility::getDeptId, deptId)
                .eq(SysDeptResponsibility::getDelFlag, UserConstant.ENABLE)
                .orderByAsc(SysDeptResponsibility::getClauseNum);
        List<SysDeptResponsibility> sysDeptResponsibilities = deptResponsibilityMapper.selectList(lambdaQueryWrapper);
        deptDetialVo.setSysDeptResponsibilitys(sysDeptResponsibilities);
        return deptDetialVo ;
    }
    /**
@@ -180,7 +208,9 @@
    public boolean checkDeptNameUnique(SysDept dept)
    {
        Long deptId = ObjectUtil.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
        SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
        Long companyId = SecurityUtils.getLoginUser().getUser().getCompanyId();
        SysDept info = deptMapper.checkDeptNameUnique(companyId,dept.getDeptName(), dept.getParentId());
        if (ObjectUtil.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
        {
            return UserConstant.NOT_UNIQUE;
@@ -196,11 +226,11 @@
    @Override
    public void checkDeptDataScope(Long deptId)
    {
        if (!SysUser.isAdmin(SecurityUtils.getUserId()) && ObjectUtil.isNotNull(deptId))
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()) && ObjectUtil.isNotNull(deptId))
        {
            SysDept dept = new SysDept();
            dept.setDeptId(deptId);
            List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
            List<SysDept> depts = SpringUtils.getAopProxy(this).getOutDeptList(dept);
            if (ObjectUtil.isEmpty(depts))
            {
                throw new ApiException("没有权限访问部门数据!");
@@ -227,6 +257,212 @@
        return deptMapper.insertDept(dept);
    }
    @Override
    public int saveDept(SysDeptSaveDTOReq dept) {
        Long companyId = SecurityUtils.getLoginUser().getUser().getCompanyId();
        if (!companyId.equals(dept.getCompanyId())){
            throw new ApiException("无权操作!");
        }
        SysDept sysDept = new SysDept();
        BeanUtils.copyProperties(dept, sysDept);
        sysDept.setCompanyId(companyId);
        boolean b = checkDeptNameUnique(sysDept);
        if (!b){
            throw new ApiException("部门名称已存在!");
        }
        int i = 0;
        if (sysDept.getDeptId() == null){
            sysDept.setCreateBy(SecurityUtils.getUsername());
             i = deptMapper.insertDept(sysDept);
        }else {
            sysDept.setUpdateBy(SecurityUtils.getUsername());
            sysDept.setUpdateTime(LocalDateTime.now());
            i = deptMapper.updateDept(sysDept);
        }
        if (i > 0){
            List<Long> delCaluseIds = dept.getDelCaluseIds();
            if (delCaluseIds != null && !delCaluseIds.isEmpty())
            {
                delCaluse(sysDept.getDeptId(), delCaluseIds);
            }
            //处理条款
            batchSaveCaluse(sysDept.getDeptId(), companyId, dept.getCaluseVO1List());
        }
        return sysDept.getDeptId().byteValue();
    }
    @Override
    public int saveDeptResponsibility(SysDeptResponsibilityReqVo reqVo) {
        Long companyId = SecurityUtils.getLoginUser().getUser().getCompanyId();
        if (!companyId.equals(reqVo.getCompanyId())){
            throw new ApiException("无权操作!");
        }
        SysDept sysDept = deptMapper.selectDeptById(reqVo.getDeptId());
        if (null == sysDept){
            throw new ApiException("部门不存在!");
        }
        if (!companyId.equals(sysDept.getCompanyId())){
            throw new ApiException("无权操作!");
        }
        SysDept dept = new SysDept();
        dept.setDeptId(reqVo.getDeptId());
        dept.setPersonNum(reqVo.getPersonNum());
        dept.setInternalAuditors(reqVo.getInternalAuditors());
        dept.setResponsibilities(reqVo.getResponsibilities());
        dept.setUpdateBy(SecurityUtils.getUsername());
        dept.setUpdateTime(LocalDateTime.now());
        int i = deptMapper.updateDept(dept);
        if (i < 1){
            throw new ApiException("编辑失败!");
        }
        batchSaveRespon(reqVo);
        return 1;
    }
    @Override
    public List<SysFunctionalDistribution> getFunctionalDistributionList(Long companyId) {
       return sysFunctionalDistributionMapper.selectListVo(companyId);
    }
    @Override
    public int initFunctionalDistribution(Long companyId) {
        if (!companyId.equals(SecurityUtils.getLoginUser().getUser().getCompanyId())){
            throw new ApiException("无权操作!");
        }
        sysFunctionalDistributionMapper.delete(new LambdaQueryWrapper<SysFunctionalDistribution>().eq(SysFunctionalDistribution::getCompanyId, SecurityUtils.getLoginUser().getUser().getCompanyId()));
        SysDept sysDept = new SysDept();
        sysDept.setCompanyId(companyId);
        List<DeptVo> deptVos = deptMapper.selectDeptList(sysDept);
        if (deptVos != null && !deptVos.isEmpty()){
            List<SysFunctionalDistribution> sysFunctionalDistributions = new ArrayList<>();
            for (DeptVo deptVo : deptVos) {
                for (String s : DEPT_ROOT) {
                    SysFunctionalDistribution sysFunctionalDistribution = new SysFunctionalDistribution();
                    sysFunctionalDistribution.setDeptId(deptVo.getDeptId());
                    sysFunctionalDistribution.setCompanyId(companyId);
                    sysFunctionalDistribution.setCreateBy(SecurityUtils.getUsername());
                    sysFunctionalDistribution.setCreateTime(LocalDateTime.now());
                    sysFunctionalDistribution.setClauseNum(s);
                    sysFunctionalDistribution.setChooseLab(0);
                    sysFunctionalDistributions.add(sysFunctionalDistribution);
                }
            }
            int i = sysFunctionalDistributionMapper.batchInsert(sysFunctionalDistributions);
            if (i < 1){
                throw new ApiException("初始化失败!");
            }
        }
        return 1;
    }
    @Override
    public int saveFunctionalDistribution(FunctionalDistributionVo reqVo) {
        Long companyId = SecurityUtils.getLoginUser().getUser().getCompanyId();
        if (!companyId.equals(reqVo.getCompanyId())){
            throw new ApiException("无权操作!");
        }
        List<SysFunctionalDistribution> list = reqVo.getList();
        int i = sysFunctionalDistributionMapper.batchUpdate(list);
        if (i < 1){
            throw new ApiException("保存失败!");
        }
        return 1;
    }
    private void batchSaveRespon(SysDeptResponsibilityReqVo reqVo) {
        List<Long> delData = reqVo.getDelData();
        if (delData != null && !delData.isEmpty())
        {
            deptResponsibilityMapper
                    .update(new SysDeptResponsibility(),
                            new LambdaUpdateWrapper<SysDeptResponsibility>().set(SysDeptResponsibility::getDelFlag, UserConstant.DEPT_DISABLE)
                                    .set(SysDeptResponsibility::getUpdateTime, LocalDateTime.now()).set(SysDeptResponsibility::getUpdateBy, SecurityUtils.getUsername())
                                    .in(SysDeptResponsibility::getId, delData)
                    );
        }
        List<SysDeptResponsibility> sysDeptResponsibilityList = reqVo.getSysDeptResponsibilityList();
        List<String> emptyIdClauseNums = sysDeptResponsibilityList.stream()
                .map(SysDeptResponsibility::getClauseNum)
                .collect(Collectors.toList());
        Set<String> emptyIdClauseNumSet = new HashSet<>(emptyIdClauseNums);
        if (emptyIdClauseNumSet.size() !=  emptyIdClauseNums.size()){
            throw new ApiException("部门条款编码重复!");
        }
        if (!emptyIdClauseNums.isEmpty()){
            List<SysDeptResponsibility> sysDeptResponsibilities = deptResponsibilityMapper.selectList(new LambdaQueryWrapper<SysDeptResponsibility>()
                    .eq(SysDeptResponsibility::getDeptId, reqVo.getDeptId()).in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums));
            if (!sysDeptResponsibilities.isEmpty()){
                throw new ApiException("部门条款编码重复!");
            }
        }
        for (SysDeptResponsibility sysDeptResponsibility : sysDeptResponsibilityList) {
            if (sysDeptResponsibility.getId() == null){
                sysDeptResponsibility.setCreateBy(SecurityUtils.getUsername());
                sysDeptResponsibility.setCreateTime(LocalDateTime.now());
                sysDeptResponsibility.setDeptId(reqVo.getDeptId());
                sysDeptResponsibility.setCompanyId(reqVo.getCompanyId());
                deptResponsibilityMapper.insert(sysDeptResponsibility);
            }else {
                sysDeptResponsibility.setUpdateBy(SecurityUtils.getUsername());
                sysDeptResponsibility.setUpdateTime(LocalDateTime.now());
                deptResponsibilityMapper.updateById(sysDeptResponsibility);
            }
        }
    }
    private void delCaluse(Long deptId,  List<Long> delCaluseIds)
    {
        deptResponsibilityMapper
                .update(new SysDeptResponsibility(),
                        new LambdaUpdateWrapper<SysDeptResponsibility>().set(SysDeptResponsibility::getDelFlag, UserConstant.DEPT_DISABLE)
                                .set(SysDeptResponsibility::getUpdateTime, LocalDateTime.now()).set(SysDeptResponsibility::getUpdateBy, SecurityUtils.getUsername())
                                .eq(SysDeptResponsibility::getDeptId, deptId));
    }
    private void batchSaveCaluse(Long deptId,Long companyId, List<CaluseVO1> caluseVO1List) {
        List<String> emptyIdClauseNums = caluseVO1List.stream()
                .filter(item -> item.getId() == null)
                .map(CaluseVO1::getClauseNum)
                .collect(Collectors.toList());
        if (!emptyIdClauseNums.isEmpty()){
            List<SysDeptResponsibility> sysDeptResponsibilities = deptResponsibilityMapper.selectList(new LambdaQueryWrapper<SysDeptResponsibility>()
                    .eq(SysDeptResponsibility::getDeptId, deptId).in(SysDeptResponsibility::getClauseNum, emptyIdClauseNums));
            if (!sysDeptResponsibilities.isEmpty()){
                throw new ApiException("部门条款编码重复!");
            }
        }
        for (CaluseVO1 caluseVO1 : caluseVO1List) {
            SysDeptResponsibility sysDeptResponsibility = new SysDeptResponsibility();
            BeanUtils.copyProperties(caluseVO1, sysDeptResponsibility);
            sysDeptResponsibility.setCompanyId(companyId);
            sysDeptResponsibility.setDeptId(deptId);
            if (sysDeptResponsibility.getId() == null){
                sysDeptResponsibility.setCreateBy(SecurityUtils.getUsername());
                sysDeptResponsibility.setCreateTime(LocalDateTime.now());
                deptResponsibilityMapper.insert(sysDeptResponsibility);
            }else {
                sysDeptResponsibility.setUpdateBy(SecurityUtils.getUsername());
                sysDeptResponsibility.setUpdateTime(LocalDateTime.now());
                deptResponsibilityMapper.updateById(sysDeptResponsibility);
            }
        }
    }
    /**
     * 修改保存部门信息
     * 
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysMenuServiceImpl.java
@@ -64,7 +64,7 @@
    {
        List<SysMenu> menuList = null;
        // 管理员显示所有菜单信息
        if (SysUser.isAdmin(userId))
        if (SecurityUtils.isAdmin(userId))
        {
            menuList = menuMapper.selectMenuList(menu);
        }
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SysRoleServiceImpl.java
@@ -197,7 +197,7 @@
    @Override
    public void checkRoleDataScope(Long... roleIds)
    {
        if (!SysUser.isAdmin(SecurityUtils.getUserId()))
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId()))
        {
            for (Long roleId : roleIds)
            {
multi-system/src/main/resources/mapper/system/SysClauseManagementMapper.xml
对比新文件
@@ -0,0 +1,19 @@
<?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.SysDeptResponsibilityMapper">
    <resultMap type="com.gkhy.exam.system.domain.SysClauseManagement" id="SysClauseManagementResult">
        <id     property="id"     column="id"     />
        <result property="clauseNum"  column="clause_num"   />
        <result property="sort"   column="sort"   />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"   column="create_by"   />
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
    </resultMap>
</mapper>
multi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -7,12 +7,12 @@
    <resultMap type="com.gkhy.exam.common.domain.entity.SysDept" id="SysDeptResult">
        <id     property="deptId"     column="dept_id"     />
        <result property="parentId"   column="parent_id"   />
        <result property="companyId"   column="company_id"   />
        <result property="ancestors"  column="ancestors"   />
        <result property="deptName"   column="dept_name"   />
        <result property="orderNum"   column="order_num"   />
        <result property="leader"     column="leader"      />
        <result property="phone"      column="phone"       />
        <result property="email"      column="email"       />
        <result property="leaderUserId"     column="leader_user_id"      />
        <result property="leaderName"     column="leader_name"      />
        <result property="status"     column="status"      />
        <result property="delFlag"    column="del_flag"    />
        <result property="parentName" column="parent_name" />
@@ -20,16 +20,35 @@
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
        <result property="responsibilities"   column="responsibilities"   />
        <result property="personNum" column="person_num" />
        <result property="internalAuditors" column="internal_auditors" />
        <result property="internalAuditorsName"   column="internal_auditors_name"   />
    </resultMap>
    <resultMap type="com.gkhy.exam.system.domain.vo.DeptVo" id="DeptVoResult" extends="SysDeptResult">
        <collection property="caluseVO1List" ofType="com.gkhy.exam.system.domain.vo.CaluseVO1">
            <id     property="clauseNum"     column="clause_num"     />
            <result property="content"     column="content"     />
        </collection>
    </resultMap>
    
    <sql id="selectDeptVo">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader_user_id, d.company_id, d.status, d.del_flag, d.create_by, d.create_time,d.person_num,d.internal_auditors,
            d.responsibilities
        from sys_dept d
    </sql>
    
    <select id="selectDeptList" parameterType="com.gkhy.exam.common.domain.entity.SysDept" resultMap="SysDeptResult">
        <include refid="selectDeptVo"/>
    <select id="selectDeptList" parameterType="com.gkhy.exam.common.domain.entity.SysDept" resultMap="DeptVoResult">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader_user_id, d.company_id, d.status, d.del_flag, d.create_by, d.create_time,d.person_num,d.internal_auditors,
        d.responsibilities,u.name as leader_name,d2.dept_name as parent_name, dr.content ,dr.clause_num
        from sys_dept d
        left join sys_user u on d.leader_user_id = u.user_id
        left join sys_dept d2 on d.parent_id = d2.dept_id
        left join sys_dept_responsibility dr on d.dept_id = dr.dept_id and dr.del_flag = '0' and data_type = 2
        where d.del_flag = '0'
        <if test="companyId != null and companyId != 0">
            AND company_id = #{companyId}
        </if>
        <if test="deptId != null and deptId != 0">
            AND dept_id = #{deptId}
        </if>
@@ -42,8 +61,6 @@
        <if test="status != null and status != ''">
            AND status = #{status}
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
        order by d.parent_id, d.order_num
    </select>
@@ -51,6 +68,9 @@
    <select id="getOutDeptList" parameterType="com.gkhy.exam.common.domain.entity.SysDept" resultMap="SysDeptResult">
        <include refid="selectDeptVo"/>
        where d.del_flag = '0'
        <if test="companyId != null and companyId != 0">
            AND company_id = #{companyId}
        </if>
        <if test="deptId != null and deptId != 0">
            AND dept_id = #{deptId}
        </if>
@@ -79,8 +99,10 @@
    </select>
    
    <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
            (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader_user_id,d.company_id,d.status,d.person_num,d.internal_auditors,
               d.responsibilities,
            (select dept_name from sys_dept where dept_id = d.parent_id) parent_name,(select dept_name from sys_user where id = d.leader_user_id) leader_name
                ,(select dept_name from sys_user where id = d.internal_auditors) internal_auditors_name
        from sys_dept d
        where d.dept_id = #{deptId}
    </select>
@@ -104,7 +126,9 @@
    
    <select id="checkDeptNameUnique" resultMap="SysDeptResult">
        <include refid="selectDeptVo"/>
        where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
        where dept_name=#{deptName} and parent_id = #{parentId}
        and company_id = #{companyId}
        and del_flag = '0' limit 1
    </select>
    
    <insert id="insertDept" parameterType="com.gkhy.exam.common.domain.entity.SysDept">
@@ -114,9 +138,11 @@
             <if test="deptName != null and deptName != ''">dept_name,</if>
             <if test="ancestors != null and ancestors != ''">ancestors,</if>
             <if test="orderNum != null">order_num,</if>
             <if test="leader != null and leader != ''">leader,</if>
             <if test="phone != null and phone != ''">phone,</if>
             <if test="email != null and email != ''">email,</if>
             <if test="leaderUserId != null ">leader_user_id,</if>
             <if test="companyId != null ">company_id,</if>
            <if test="personNum != null">person_num,</if>
            <if test="internalAuditors != null">internal_auditors,</if>
            <if test="responsibilities != null and responsibilities != ''">responsibilities,</if>
             <if test="status != null">status,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             create_time
@@ -126,9 +152,11 @@
             <if test="deptName != null and deptName != ''">#{deptName},</if>
             <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
             <if test="orderNum != null">#{orderNum},</if>
             <if test="leader != null and leader != ''">#{leader},</if>
             <if test="phone != null and phone != ''">#{phone},</if>
             <if test="email != null and email != ''">#{email},</if>
             <if test="leaderUserId != null">#{leaderUserId},</if>
             <if test="companyId != null ">#{companyId},</if>
            <if test="personNum != null">#{personNum},</if>
            <if test="internalAuditors != null">#{internalAuditors},</if>
            <if test="responsibilities != null and responsibilities != ''">#{responsibilities},</if>
             <if test="status != null">#{status},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             sysdate()
@@ -142,9 +170,10 @@
             <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
             <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
             <if test="orderNum != null">order_num = #{orderNum},</if>
             <if test="leader != null">leader = #{leader},</if>
             <if test="phone != null">phone = #{phone},</if>
             <if test="email != null">email = #{email},</if>
             <if test="leaderUserId != null">leader_user_id = #{leaderUserId},</if>
            <if test="personNum != null">person_num = #{personNum},</if>
            <if test="internalAuditors != null">internal_auditors = #{internalAuditors},</if>
            <if test="responsibilities != null and responsibilities != ''">responsibilities = #{responsibilities},</if>
             <if test="status != null and status != ''">status = #{status},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             update_time = sysdate()
multi-system/src/main/resources/mapper/system/SysDeptResponsibilityMapper.xml
对比新文件
@@ -0,0 +1,28 @@
<?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.SysDeptResponsibilityMapper">
    <resultMap type="com.gkhy.exam.system.domain.SysDeptResponsibility" id="SysDeptResponsibilityResult">
        <id     property="id"     column="id"     />
        <result property="deptId"     column="dept_id"     />
        <result property="companyId"   column="company_id"   />
        <result property="clauseId"   column="clause_id"   />
        <result property="clauseNum"  column="clause_num"   />
        <result property="content"   column="content"   />
        <result property="leader"   column="leader"   />
        <result property="evidenceMaterials"     column="evidence_materials"      />
        <result property="managementDocuments"     column="management_documents"      />
        <result property="technicalDocuments"     column="technical_documents"      />
        <result property="existingRecords"     column="existing_records"      />
        <result property="dataType"     column="data_type"      />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"   column="create_by"   />
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
    </resultMap>
</mapper>
multi-system/src/main/resources/mapper/system/SysFunctionalDistributionMapper.xml
对比新文件
@@ -0,0 +1,57 @@
<?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.SysFunctionalDistributionMapper">
    <resultMap type="com.gkhy.exam.system.domain.SysFunctionalDistribution" id="SysFunctionalDistributionResult">
        <result property="deptId"     column="dept_id"     />
        <result property="companyId"   column="company_id"   />
        <result property="clauseNum"  column="clause_num"   />
        <result property="chooseLab"   column="choose_lab"   />
        <result  property="deptName"   column="dept_name"   />
        <result property="createBy"   column="create_by"   />
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
    </resultMap>
    <select id="selectListVo" parameterType="long" resultMap="SysFunctionalDistributionResult">
        select
        a.dept_id,
        b.dept_name,
        a.company_id,
        a.clause_num,
        a.choose_lab,
        a.dept_name,
        a.create_by,
        a.create_time,
        a.update_by,
            a.update_time
        from sys_functional_distribution a
        left join sys_dept b on a.dept_id = b.id
        where 1=1 and a.company_id = #{companyId}
        order by a.clause_num asc
    </select>
    <insert id="batchInsert">
        insert into sys_functional_distribution(dept_id, company_id,clause_num,choose_lab,create_by,create_time) values
        <foreach item="item" index="index" collection="list" separator=",">
            (#{item.deptId},#{item.companyId},#{item.clauseNum},#{item.chooseLab},#{item.createBy},#{item.createTime})
        </foreach>
    </insert>
    <update id="batchUpdate" parameterType="java.util.List">
        <foreach collection="list" item="item" separator=";">
            update sys_functional_distribution
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.score != null">choose_lab = #{item.chooseLab},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
            </trim>
            where dept_id = #{item.deptId} and company_id = #{item.companyId} and clause_num = #{item.clauseNum}
        </foreach>
    </update>
</mapper>
multi-system/src/main/resources/mapper/system/SysMenuMapper.xml
@@ -80,8 +80,8 @@
             left join sys_role_menu rm on m.menu_id = rm.menu_id
             left join sys_user_role ur on rm.role_id = ur.role_id
             left join sys_role ro on ur.role_id = ro.role_id
             left join sys_user u on ur.user_id = u.user_id
        where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0  AND ro.status = 0
             left join sys_user u on ur.user_id = u.id
        where u.id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0  AND ro.status = 0
        order by m.parent_id, m.order_num
    </select>
    
multi-system/src/main/resources/mapper/system/SysRoleMapper.xml
@@ -26,7 +26,7 @@
            r.status, r.del_flag, r.create_time, r.remark 
        from sys_role r
            left join sys_user_role ur on ur.role_id = r.role_id
            left join sys_user u on u.user_id = ur.user_id
            left join sys_user u on u.id = ur.user_id
            left join sys_dept d on u.dept_id = d.dept_id
    </sql>
    
@@ -69,8 +69,8 @@
        select r.role_id
        from sys_role r
            left join sys_user_role ur on ur.role_id = r.role_id
            left join sys_user u on u.user_id = ur.user_id
        where u.user_id = #{userId}
            left join sys_user u on u.id = ur.user_id
        where u.id = #{userId}
    </select>
    
    <select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
multi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -26,6 +26,12 @@
        <result property="companyName"        column="company_name"          />
        <result property="remainPeriod"        column="remain_period"          />
        <result property="parentName"        column="parent_name"          />
        <result property="idCard"        column="id_card"          />
        <result property="duty"        column="duty"          />
        <result property="post"        column="post"          />
        <result property="deptId"        column="dept_id"          />
        <result property="deptName"        column="dept_name"          />
        <result  property="entryTime"        column="entry_time"          />
    </resultMap>
@@ -42,10 +48,12 @@
    <select id="userList"  resultMap="SysUserResult">
        select u.id,u.username,u.name,u.user_type,u.phone,u.parent_id,u.company_id,u.sex,u.status,u.del_flag,u.version,
               u.login_ip,u.login_date,u.create_by,u.create_time,u.remark,c.name as company_name,su.name as parent_name
               u.login_ip,u.login_date,u.create_by,u.create_time,u.remark,c.name as company_name,su.name as parent_name,
                u.dept_id,d.dept_name,u.duty,u.post,u.id_card,u.entry_time
        from sys_user u
        left join sys_company c on c.id=u.company_id
        left join sys_user su on su.id=u.parent_id and u.parent_id!=0
        left join sys_dept  d on d.dept_id=u.dept_id
        <where>
            and u.del_flag = 0
            <if test="username != null and username != ''">
@@ -93,10 +101,12 @@
    </select>
    <select id="getUserById" resultMap="SysUserResult">
        select u.id,u.username,u.user_type,u.name,u.phone,u.parent_id,u.company_id,u.status,u.sex,u.del_flag,u.version,c.name as company_name,c.remain_period,su.name as parent_name
        select u.id,u.username,u.user_type,u.name,u.phone,u.parent_id,u.company_id,u.status,u.sex,u.del_flag,u.version,c.name as company_name,
               c.remain_period,su.name as parent_name,u.dept_id,d.dept_name,u.duty,u.post,u.id_card,u.entry_time
        from sys_user u
       left join sys_company c on c.id=u.company_id
       left join sys_user su on su.id=u.parent_id and u.parent_id!=0
        left join sys_dept  d on d.dept_id=u.dept_id
        where u.id=#{userId}
    </select>
@@ -114,10 +124,10 @@
    <select id="selectAllocatedList" parameterType="com.gkhy.exam.common.domain.entity.SysUser" resultMap="SysUserResult">
        select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
        select distinct u.id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
        from sys_user u
        left join sys_dept d on u.dept_id = d.dept_id
        left join sys_user_role ur on u.user_id = ur.user_id
        left join sys_user_role ur on u.id = ur.user_id
        left join sys_role r on r.role_id = ur.role_id
        where u.del_flag = '0' and r.role_id = #{roleId}
        <if test="userName != null and userName != ''">
@@ -126,26 +136,22 @@
        <if test="phonenumber != null and phonenumber != ''">
            AND u.phonenumber like concat('%', #{phonenumber}, '%')
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
    <select id="selectUnallocatedList" parameterType="com.gkhy.exam.common.domain.entity.SysUser" resultMap="SysUserResult">
        select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
        select distinct u.id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
        from sys_user u
        left join sys_dept d on u.dept_id = d.dept_id
        left join sys_user_role ur on u.user_id = ur.user_id
        left join sys_user_role ur on u.id = ur.user_id
        left join sys_role r on r.role_id = ur.role_id
        where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
        and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
        and u.id not in (select u.id from sys_user u inner join sys_user_role ur on u.id = ur.user_id and ur.role_id = #{roleId})
        <if test="userName != null and userName != ''">
            AND u.user_name like concat('%', #{userName}, '%')
        </if>
        <if test="phonenumber != null and phonenumber != ''">
            AND u.phonenumber like concat('%', #{phonenumber}, '%')
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
</mapper>