代码调整

This commit is contained in:
xy
2024-08-16 13:17:30 +08:00
parent 90d1337a45
commit e6e3ae958b

View File

@@ -324,10 +324,15 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
* 获取子节点 * 获取子节点
*/ */
public List<CsLedgerVO> getChildren(CsLedgerVO item, List<CsLedgerVO> all) { public List<CsLedgerVO> getChildren(CsLedgerVO item, List<CsLedgerVO> all) {
return all.stream() // 筛选所有具有特定父ID的子项
List<CsLedgerVO> children = all.stream()
.filter(allItem -> allItem.getPid().equals(item.getId())) .filter(allItem -> allItem.getPid().equals(item.getId()))
.peek(child -> child.setComFlag(item.getComFlag()))
.collect(Collectors.toList()); .collect(Collectors.toList());
// 如果父项有comFlag则更新所有子项的comFlag
if (!Objects.isNull(item.getComFlag())) {
children.forEach(child -> child.setComFlag(item.getComFlag()));
}
return children;
} }
public String getAreaById(String id){ public String getAreaById(String id){