Browse Source

解决添加公路路段去重,防止前端提交了重复的数据

tags/v1.0.0^2^2
wanjing 1 year ago
parent
commit
abc5164077
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/update/UpdateDeptService.java

+ 4
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/update/UpdateDeptService.java View File

@@ -201,6 +201,8 @@ public class UpdateDeptService {
// 差集:新增公路
Collection<String> addRoadIdList = org.apache.commons.collections4.CollectionUtils.subtract(newRoadIdList, oldRoadIdList);
if (!CollectionUtils.isEmpty(addRoadIdList)) {
// 去重,防止前端提交了重复的数据
addRoadIdList= addRoadIdList.stream().distinct().collect(Collectors.toList());
this.addRoadToDept(tenantId, newEditDeptRequest.getId(), addRoadIdList);
}

@@ -301,6 +303,8 @@ public class UpdateDeptService {
Collection<String> addSectionIdList = org.apache.commons.collections4.CollectionUtils.subtract(newSectionIdList, oldSectionIdList);

if (!CollectionUtils.isEmpty(addSectionIdList)) {
// 去重,防止前端提交了重复的数据
addSectionIdList= addSectionIdList.stream().distinct().collect(Collectors.toList());
// 添加路段和部门数据
this.addSectionToDept(tenantId, newEditDeptRequest.getId(), addSectionIdList);
}

Loading…
Cancel
Save