李一帆 2025-04-11 09:17:24 +08:00
parent 6de6111a6c
commit ebd2b29f70
1 changed files with 2 additions and 10 deletions

View File

@ -125,7 +125,7 @@ public class SzTreatmentBasisController{
.collect(Collectors.toList());
parentList.forEach(this::trim);
parentList.removeIf(node -> CollectionUtils.isEmpty(node.getChildren()));
parentList.removeIf(node -> CollectionUtils.isEmpty(node.getChildren()) && (Integer.valueOf(0).equals(node.getDisplay()) || node.getDisplay() == null));
return R.ok(parentList);
}
@ -135,19 +135,11 @@ public class SzTreatmentBasisController{
boolean isMiddleNode = false;
if (CollectionUtils.isNotEmpty(children)) {
isMiddleNode = true;
Iterator<SzTreatmentBasis> iterator = children.iterator();
// while (iterator.hasNext()) {
// SzTreatmentBasis child = iterator.next();
// boolean f = trim(child);
// if (f) {
// iterator.remove();
// }
// }
children.removeIf(this::trim);
}
//没有子节点的节点且display是0是末端节点没有子节点的节点且曾经有过子节点是中间节点
//末端节点的display是0就删中间节点没有子节点就删
return CollectionUtils.isEmpty(children) && (Integer.valueOf(0).equals(node.getDisplay()) || isMiddleNode);
return CollectionUtils.isEmpty(children) && (isMiddleNode || Integer.valueOf(0).equals(node.getDisplay()));
}
@Operation(summary = "删除")