|
|
@@ -121,21 +121,23 @@ public class UpdateDeptService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 判断是否已存在该部门名称,同部门下,部门名称不能重复, |
|
|
|
// 注意要增加id不能与自己的相同的判断 |
|
|
|
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>() |
|
|
|
.eq(Dept::getTenantId, tenantId) |
|
|
|
.eq(Dept::getPid, newEditDeptRequest.getPid()) |
|
|
|
.ne(Dept::getId, newEditDeptRequest.getId()) |
|
|
|
.eq(Dept::getName, newEditDeptRequest.getName()) |
|
|
|
.eq(Dept::getMark, 1)); |
|
|
|
if (!oldEditDeptRequest.getName().equals(newEditDeptRequest.getName())) { |
|
|
|
// 判断是否已存在该部门名称,同部门下,部门名称不能重复, |
|
|
|
// 注意要增加id不能与自己的相同的判断 |
|
|
|
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>() |
|
|
|
.eq(Dept::getTenantId, tenantId) |
|
|
|
.eq(Dept::getPid, newEditDeptRequest.getPid()) |
|
|
|
.ne(Dept::getId, newEditDeptRequest.getId()) |
|
|
|
.eq(Dept::getName, newEditDeptRequest.getName()) |
|
|
|
.eq(Dept::getMark, 1)); |
|
|
|
|
|
|
|
// 系统中已存在 |
|
|
|
if (count > 0) { |
|
|
|
return JsonResult.error(EditDeptCodeEnum.DEPT_NAME_IS_ALREADY_EXIST.getCode(), EditDeptCodeEnum.DEPT_NAME_IS_ALREADY_EXIST.getMsg()); |
|
|
|
// 系统中已存在 |
|
|
|
if (count > 0) { |
|
|
|
return JsonResult.error(EditDeptCodeEnum.DEPT_NAME_IS_ALREADY_EXIST.getCode(), EditDeptCodeEnum.DEPT_NAME_IS_ALREADY_EXIST.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 新增部门,公路和路段信息不能为空 |
|
|
|
// 修改部门,公路和路段信息不能为空 |
|
|
|
if (CollectionUtils.isEmpty(newEditDeptRequest.getRoadSectionDtoList())) { |
|
|
|
return JsonResult.error(EditDeptCodeEnum.ROAD_IS_NULL.getCode(), EditDeptCodeEnum.ROAD_IS_NULL.getMsg()); |
|
|
|
} |
|
|
@@ -198,11 +200,15 @@ public class UpdateDeptService { |
|
|
|
|
|
|
|
// 差集:新增公路 |
|
|
|
Collection<String> addRoadIdList = org.apache.commons.collections4.CollectionUtils.subtract(newRoadIdList, oldRoadIdList); |
|
|
|
this.addRoadToDept(tenantId, newEditDeptRequest.getId(), addRoadIdList); |
|
|
|
if (!CollectionUtils.isEmpty(addRoadIdList)) { |
|
|
|
this.addRoadToDept(tenantId, newEditDeptRequest.getId(), addRoadIdList); |
|
|
|
} |
|
|
|
|
|
|
|
// 差集:删除公路 |
|
|
|
Collection<String> subRoadIdList = org.apache.commons.collections4.CollectionUtils.subtract(oldRoadIdList, newRoadIdList); |
|
|
|
this.removeRoadToDept(tenantId, newEditDeptRequest.getId(), subRoadIdList); |
|
|
|
if (!CollectionUtils.isEmpty(subRoadIdList)) { |
|
|
|
this.removeRoadToDept(tenantId, newEditDeptRequest.getId(), subRoadIdList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -293,13 +299,18 @@ public class UpdateDeptService { |
|
|
|
|
|
|
|
// 差集:新增公路 |
|
|
|
Collection<String> addSectionIdList = org.apache.commons.collections4.CollectionUtils.subtract(newSectionIdList, oldSectionIdList); |
|
|
|
// 添加路段和部门数据 |
|
|
|
this.addSectionToDept(tenantId, newEditDeptRequest.getId(), addSectionIdList); |
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(addSectionIdList)) { |
|
|
|
// 添加路段和部门数据 |
|
|
|
this.addSectionToDept(tenantId, newEditDeptRequest.getId(), addSectionIdList); |
|
|
|
} |
|
|
|
|
|
|
|
// 差集:删除公路 |
|
|
|
Collection<String> subSectionIdList = org.apache.commons.collections4.CollectionUtils.subtract(oldSectionIdList, newSectionIdList); |
|
|
|
// 删除路段和部门数据 |
|
|
|
this.removeSectionToDept(tenantId, newEditDeptRequest.getId(), subSectionIdList); |
|
|
|
if (!CollectionUtils.isEmpty(subSectionIdList)) { |
|
|
|
// 删除路段和部门数据 |
|
|
|
this.removeSectionToDept(tenantId, newEditDeptRequest.getId(), subSectionIdList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |