fix(自定义对比): 维护清单编辑问题修复
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ public class LawsCustomCompareInfoController {
|
||||
@AutoLog(value = "自定义对比-清单维护编辑")
|
||||
@ApiOperation(value="自定义对比-清单维护编辑", notes="自定义对比-清单维护编辑")
|
||||
@PostMapping(value = "/editInventory")
|
||||
public Result<T> editInventory(Map<String, Object> map) {
|
||||
public Result<T> editInventory(@RequestBody Map<String, Object> map) {
|
||||
lawsCustomCompareInfoService.editInventory(map);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
+8
-19
@@ -387,36 +387,25 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
|
||||
|
||||
// 不是第一次添加
|
||||
if (!list.isEmpty()){
|
||||
List<String> idList = list.stream().map(LawsCustomCompareInventory::getInfoId).collect(Collectors.toList());
|
||||
List<String> featureIdList = featureList.stream().map(LawsCustomCompareInventory::getInfoId).collect(Collectors.toList());
|
||||
List<String> compareIdList = compareList.stream().map(LawsCustomCompareInventory::getInfoId).collect(Collectors.toList());
|
||||
List<String> idList = list.stream().map(LawsCustomCompareInventory::getId).collect(Collectors.toList());
|
||||
List<String> featureIdList = featureList.stream().map(LawsCustomCompareInventory::getId).collect(Collectors.toList());
|
||||
List<String> compareIdList = compareList.stream().map(LawsCustomCompareInventory::getId).collect(Collectors.toList());
|
||||
|
||||
idList.retainAll(featureIdList);
|
||||
idList.retainAll(compareIdList);
|
||||
idList.removeAll(featureIdList);
|
||||
idList.removeAll(compareIdList);
|
||||
|
||||
if (!idList.isEmpty()){
|
||||
// 删除旧数据
|
||||
lawsCustomCompareInventoryService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareInventory>()
|
||||
.in(LawsCustomCompareInventory::getId, idList));
|
||||
|
||||
// 删除单元格数据
|
||||
lawsCustomCompareCellService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareCell>()
|
||||
.in(LawsCustomCompareCell::getFeatureId, idList)
|
||||
.or().eq(LawsCustomCompareCell::getCompareItemId, idList));
|
||||
}else {
|
||||
// 删除旧数据
|
||||
lawsCustomCompareInventoryService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareInventory>()
|
||||
.eq(LawsCustomCompareInventory::getInfoId, infoId));
|
||||
|
||||
// 删除单元格数据
|
||||
lawsCustomCompareCellService.remove(
|
||||
new LambdaQueryWrapper<LawsCustomCompareCell>()
|
||||
.eq(LawsCustomCompareCell::getInfoId, infoId));
|
||||
.in(LawsCustomCompareCell::getInfoId, infoId)
|
||||
.and(v -> v.eq(LawsCustomCompareCell::getFeatureId, idList)
|
||||
.or().eq(LawsCustomCompareCell::getCompareItemId, idList)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user