|
|
|
|
|
|
|
|
private void addRoadAndSectionToDept(String tenantId, String deptId, List<RoadSectionDto> roadSectionDtoList) { |
|
|
private void addRoadAndSectionToDept(String tenantId, String deptId, List<RoadSectionDto> roadSectionDtoList) { |
|
|
List<RoadInformation> roadInformationList = new ArrayList<>(); |
|
|
List<RoadInformation> roadInformationList = new ArrayList<>(); |
|
|
List<Section> sectionList = new ArrayList<>(); |
|
|
List<Section> sectionList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
RoadInformation road; |
|
|
RoadInformation road; |
|
|
List<Section> sectionListTmp; |
|
|
List<Section> sectionListTmp; |
|
|
for (RoadSectionDto roadSectionDto : roadSectionDtoList) { |
|
|
for (RoadSectionDto roadSectionDto : roadSectionDtoList) { |
|
|
road = roadSectionDto.getRoad(); |
|
|
road = roadSectionDto.getRoad(); |
|
|
sectionListTmp = roadSectionDto.getSectionList(); |
|
|
sectionListTmp = roadSectionDto.getSectionList(); |
|
|
|
|
|
|
|
|
roadInformationList.add(road); |
|
|
roadInformationList.add(road); |
|
|
sectionList.addAll(sectionListTmp); |
|
|
sectionList.addAll(sectionListTmp); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<RoadDept> list = new ArrayList<>(); |
|
|
List<RoadDept> list = new ArrayList<>(); |
|
|
RoadDept roadDept; |
|
|
RoadDept roadDept; |
|
|
for (RoadInformation roadInformation : roadInformationList) { |
|
|
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 = new RoadDept(); |
|
|
roadDept.setTenantId(tenantId); |
|
|
roadDept.setTenantId(tenantId); |
|
|
roadDept.setDeptId(deptId); |
|
|
roadDept.setDeptId(deptId); |
|
|
|
|
|
|
|
|
List<SectionDept> list = new ArrayList<>(); |
|
|
List<SectionDept> list = new ArrayList<>(); |
|
|
SectionDept sectionDept; |
|
|
SectionDept sectionDept; |
|
|
for (Section section : sectionList) { |
|
|
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 = new SectionDept(); |
|
|
sectionDept.setTenantId(tenantId); |
|
|
sectionDept.setTenantId(tenantId); |
|
|
sectionDept.setDeptId(deptId); |
|
|
sectionDept.setDeptId(deptId); |