|
@ -194,35 +194,9 @@ public class PointAdditiveRuleServiceImpl extends BaseServiceImpl<PointAdditiveR |
|
|
@Override |
|
|
@Override |
|
|
public Result<List<List4ApplyResultDTO>> list4apply(List4applyFormDTO dto) { |
|
|
public Result<List<List4ApplyResultDTO>> list4apply(List4applyFormDTO dto) { |
|
|
List<List4ApplyResultDTO> list = baseDao.selectList4apply(dto); |
|
|
List<List4ApplyResultDTO> list = baseDao.selectList4apply(dto); |
|
|
List<List4ApplyResultDTO> result = build(list); |
|
|
return new Result<List<List4ApplyResultDTO>>().ok(list); |
|
|
result.removeIf(category ->CollectionUtils.isEmpty(category.getChildren())); |
|
|
|
|
|
return new Result<List<List4ApplyResultDTO>>().ok(result); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 构建树节点 |
|
|
|
|
|
*/ |
|
|
|
|
|
public static List<List4ApplyResultDTO> build(List<List4ApplyResultDTO> treeNodes) { |
|
|
|
|
|
List<List4ApplyResultDTO> result = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
//list转map
|
|
|
|
|
|
Map<String, List4ApplyResultDTO> nodeMap = new LinkedHashMap<>(treeNodes.size()); |
|
|
|
|
|
for(List4ApplyResultDTO treeNode : treeNodes){ |
|
|
|
|
|
nodeMap.put(treeNode.getId(), treeNode); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for(List4ApplyResultDTO node : nodeMap.values()) { |
|
|
|
|
|
List4ApplyResultDTO parent = nodeMap.get(node.getPid()); |
|
|
|
|
|
if(parent != null && !(node.getId().equals(parent.getId()))){ |
|
|
|
|
|
parent.getChildren().add(node); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
result.add(node); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Result<List<PointAdditiveRuleDTO>> list4tree(List4treeFormDTO dto) { |
|
|
public Result<List<PointAdditiveRuleDTO>> list4tree(List4treeFormDTO dto) { |
|
|