|
|
@@ -160,13 +160,11 @@ public class AddDeptService { |
|
|
|
private void addRoadAndSectionToDept(String tenantId, String deptId, List<RoadSectionDto> roadSectionDtoList) { |
|
|
|
List<RoadInformation> roadInformationList = new ArrayList<>(); |
|
|
|
List<Section> sectionList = new ArrayList<>(); |
|
|
|
|
|
|
|
RoadInformation road; |
|
|
|
List<Section> sectionListTmp; |
|
|
|
for (RoadSectionDto roadSectionDto : roadSectionDtoList) { |
|
|
|
road = roadSectionDto.getRoad(); |
|
|
|
sectionListTmp = roadSectionDto.getSectionList(); |
|
|
|
|
|
|
|
roadInformationList.add(road); |
|
|
|
sectionList.addAll(sectionListTmp); |
|
|
|
} |
|
|
@@ -198,6 +196,14 @@ public class AddDeptService { |
|
|
|
List<RoadDept> list = new ArrayList<>(); |
|
|
|
RoadDept roadDept; |
|
|
|
for (RoadInformation roadInformation : roadInformationList) { |
|
|
|
Integer count = roadDeptMapper.selectCount(new LambdaQueryWrapper<RoadDept>() |
|
|
|
.eq(RoadDept::getTenantId, tenantId) |
|
|
|
.eq(RoadDept::getDeptId, deptId) |
|
|
|
.eq(RoadDept::getRoadId, roadInformation.getId())); |
|
|
|
if (count > 0) { |
|
|
|
// 已经存在,不用在添加,防止出现冗余数据 |
|
|
|
continue; |
|
|
|
} |
|
|
|
roadDept = new RoadDept(); |
|
|
|
roadDept.setTenantId(tenantId); |
|
|
|
roadDept.setDeptId(deptId); |
|
|
@@ -231,6 +237,15 @@ public class AddDeptService { |
|
|
|
List<SectionDept> list = new ArrayList<>(); |
|
|
|
SectionDept sectionDept; |
|
|
|
for (Section section : sectionList) { |
|
|
|
Integer count = sectionDeptMapper.selectCount(new LambdaQueryWrapper<SectionDept>() |
|
|
|
.eq(SectionDept::getTenantId, tenantId) |
|
|
|
.eq(SectionDept::getDeptId, deptId) |
|
|
|
.eq(SectionDept::getSectionId, section.getId())); |
|
|
|
if (count > 0) { |
|
|
|
// 已经存在,不用在添加,防止出现冗余数据 |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
sectionDept = new SectionDept(); |
|
|
|
sectionDept.setTenantId(tenantId); |
|
|
|
sectionDept.setDeptId(deptId); |