过滤空值
This commit is contained in:
@@ -57,7 +57,7 @@ public class SysRoleTemplateServiceImpl extends ServiceImpl<SysRoleTemplateMappe
|
|||||||
// 存根节点
|
// 存根节点
|
||||||
List<SysRoleTemplate> roots = new ArrayList<>();
|
List<SysRoleTemplate> roots = new ArrayList<>();
|
||||||
|
|
||||||
list.forEach(item -> {
|
for (SysRoleTemplate item : list) {
|
||||||
if (item.getPid() == null || item.getPid() == 0) {
|
if (item.getPid() == null || item.getPid() == 0) {
|
||||||
// 这是根节点
|
// 这是根节点
|
||||||
roots.add(item);
|
roots.add(item);
|
||||||
@@ -68,7 +68,12 @@ public class SysRoleTemplateServiceImpl extends ServiceImpl<SysRoleTemplateMappe
|
|||||||
parent.getChildren().add(item);
|
parent.getChildren().add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
if (isEnable != null && isEnable == 1) {
|
||||||
|
roots = roots.stream()
|
||||||
|
.filter(root -> root.getChildren() != null && !root.getChildren().isEmpty())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user