| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | |
| | |
| | | } |
| | | |
| | | // 删除多余节点 |
| | | List<PlanNode> needDeleteNode = planNodeMapper.selectList(new LambdaQueryWrapper<PlanNode>() |
| | | List<Long> existNodeIds = savePlanNodeVos.stream().map(SavePlanNodeVo::getId).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<PlanNode> planNodeLambdaQueryWrapper = new LambdaQueryWrapper<PlanNode>() |
| | | .select(PlanNode::getId) |
| | | .eq(PlanNode::getProjectManagementPlanId, planId) |
| | | .ne(PlanNode::getId, savePlanNodeVos.get(0).getId()) |
| | | .notIn(PlanNode::getId, savePlanNodeVos.stream().map(SavePlanNodeVo::getId).collect(Collectors.toList()))); |
| | | .eq(PlanNode::getProjectManagementPlanId, planId); |
| | | if(CollUtil.isNotEmpty(existNodeIds)){ |
| | | planNodeLambdaQueryWrapper.notIn(PlanNode::getId, existNodeIds); |
| | | } |
| | | List<PlanNode> needDeleteNode = planNodeMapper.selectList(planNodeLambdaQueryWrapper); |
| | | |
| | | deletePlanNode(needDeleteNode.stream().map(PlanNode::getId).collect(Collectors.toList())); |
| | | |
| | | List<PlanNode> planNodes = BeanUtil.copyToList(savePlanNodeVos, PlanNode.class); |