|
|
|
@ -26,8 +26,9 @@ public class DeptManageServiceImpl implements DeptManageService {
|
|
|
|
|
Assert.notEmpty(deptInfoReqVo.getDeptName(), "部门名称不能为空");
|
|
|
|
|
Assert.notEmpty(deptInfoReqVo.getDeptCode(), "部门编码不能为空");
|
|
|
|
|
|
|
|
|
|
Long count = systemDeptService.lambdaQuery().eq(SystemDept::getDeptCode, deptInfoReqVo.getDeptCode()).count();
|
|
|
|
|
Assert.isTrue(count == 0, "部门编码已存在");
|
|
|
|
|
Long count = systemDeptService.lambdaQuery().eq(SystemDept::getDeptCode, deptInfoReqVo.getDeptCode())
|
|
|
|
|
.or(true,(queryWrapper -> queryWrapper.eq(SystemDept::getDeptName, deptInfoReqVo.getDeptName()))).count();
|
|
|
|
|
Assert.isTrue(count == 0, "部门名或编码已存在");
|
|
|
|
|
SystemDept systemDept = new SystemDept();
|
|
|
|
|
systemDept.setDeptCode(deptInfoReqVo.getDeptCode());
|
|
|
|
|
systemDept.setDeptName(deptInfoReqVo.getDeptName());
|
|
|
|
@ -48,9 +49,11 @@ public class DeptManageServiceImpl implements DeptManageService {
|
|
|
|
|
Assert.notEmpty(deptInfoReqVo.getDeptCode(), "部门编码不能为空");
|
|
|
|
|
|
|
|
|
|
Long count = systemDeptService.lambdaQuery()
|
|
|
|
|
.eq(SystemDept::getDeptCode, deptInfoReqVo.getDeptCode())
|
|
|
|
|
.ne(SystemDept::getId, deptInfoReqVo.getId()).count();
|
|
|
|
|
Assert.isTrue(count == 0, "部门编码已存在,请换一个部门编码");
|
|
|
|
|
.and(true,(queryWrapper -> queryWrapper.eq(SystemDept::getDeptCode, deptInfoReqVo.getDeptCode())
|
|
|
|
|
.or().eq(SystemDept::getDeptName, deptInfoReqVo.getDeptName())))
|
|
|
|
|
.and(true,(queryWrapper -> queryWrapper.ne(SystemDept::getId, deptInfoReqVo.getId())))
|
|
|
|
|
.count();
|
|
|
|
|
Assert.isTrue(count == 0, "部门名或编码已存在");
|
|
|
|
|
|
|
|
|
|
SystemDept systemDept = new SystemDept();
|
|
|
|
|
systemDept.setId(deptInfoReqVo.getId());
|
|
|
|
|