|
|
@ -69,9 +69,13 @@ public class QuoteDetailBomTree { |
|
|
public void addChildren(List<QuoteDetailBomTree> nodes) { |
|
|
public void addChildren(List<QuoteDetailBomTree> nodes) { |
|
|
for (QuoteDetailBomTree node : nodes) { |
|
|
for (QuoteDetailBomTree node : nodes) { |
|
|
if (this.id.equals(node.getParentId())) { |
|
|
if (this.id.equals(node.getParentId())) { |
|
|
|
|
|
// 检查是否已经添加过该节点(通过id去重) |
|
|
|
|
|
boolean exists = this.list.stream().anyMatch(n -> n.getId().equals(node.getId())); |
|
|
|
|
|
if (!exists) { |
|
|
this.list.add(node); |
|
|
this.list.add(node); |
|
|
node.addChildren(nodes); // 递归调用,添加子节点 |
|
|
node.addChildren(nodes); // 递归调用,添加子节点 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |