代码调整
This commit is contained in:
@@ -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){
|
||||||
|
|||||||
Reference in New Issue
Block a user