|
@@ -860,15 +860,10 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
List<WbsTreeContract> wbsTreeContractList = wbsTreeContractMapper.selectContractList(pawDTO.getWbsId(), pawDTO.getProjectId(), ids1);
|
|
|
|
|
|
if (wbsTreeContractList.size() > 0) {
|
|
|
- List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
|
- wbsTreeContractList.forEach(list -> {
|
|
|
- ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
|
- .select(ContractInfo::getContractName)
|
|
|
- .eq(ContractInfo::getId, list.getContractId()));
|
|
|
- contractInfoArrayList.add(contractInfos);
|
|
|
- });
|
|
|
- List<String> names = contractInfoArrayList.stream().distinct().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
- if (wbsTreeContractList.size() > 0) {
|
|
|
+ Set<String> contractIds = wbsTreeContractList.stream().map(WbsTreeContract::getContractId).collect(Collectors.toSet());
|
|
|
+ List<ContractInfo> contractInfoArrayList = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().select(ContractInfo::getContractName).in(ContractInfo::getId, contractIds));
|
|
|
+ if (contractInfoArrayList.size() > 0) {
|
|
|
+ List<String> names = contractInfoArrayList.stream().distinct().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
String join = StringUtils.join(names, ",");
|
|
|
return R.fail(400, StringUtil.format("当前项目wbs树的节点已被 {} 引用中,删除失败", join));
|
|
|
}
|
|
@@ -902,15 +897,10 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
|
|
|
List<WbsTreeContract> wbsTreeContractList = wbsTreeContractMapper.selectContractList(pawDTO.getPrimaryKeyId(), pawDTO.getProjectId(), ids2);
|
|
|
|
|
|
if (wbsTreeContractList.size() > 0) {
|
|
|
- List<ContractInfo> contractInfoArrayList = new ArrayList<>();
|
|
|
- wbsTreeContractList.forEach(list -> {
|
|
|
- ContractInfo contractInfos = contractInfoMapper.selectOne(Wrappers.<ContractInfo>query().lambda()
|
|
|
- .select(ContractInfo::getContractName)
|
|
|
- .eq(ContractInfo::getId, list.getContractId()));
|
|
|
- contractInfoArrayList.add(contractInfos);
|
|
|
- });
|
|
|
- List<String> names = contractInfoArrayList.stream().distinct().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
- if (wbsTreeContractList.size() > 0) {
|
|
|
+ Set<String> contractIds = wbsTreeContractList.stream().map(WbsTreeContract::getContractId).collect(Collectors.toSet());
|
|
|
+ List<ContractInfo> contractInfoArrayList = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().select(ContractInfo::getContractName).in(ContractInfo::getId, contractIds));
|
|
|
+ if (contractInfoArrayList.size() > 0) {
|
|
|
+ List<String> names = contractInfoArrayList.stream().distinct().map(ContractInfo::getContractName).collect(Collectors.toList());
|
|
|
String join = StringUtils.join(names, ",");
|
|
|
return R.fail(400, StringUtil.format("当前项目wbs树的节点已被 {} 引用中,删除失败", join));
|
|
|
}
|