|
@@ -82,8 +82,13 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
collect(Collectors.toList());
|
|
|
// 查询其孩子节点
|
|
|
collect.forEach(e -> {
|
|
|
+ e.setLevel(1);
|
|
|
List<KnowledgeCategoryAdminVo> childrens = findChildrens(e);
|
|
|
- e.setChildren(childrens);
|
|
|
+ if (childrens.size() == 0){
|
|
|
+ e.setChildren(null);
|
|
|
+ } else {
|
|
|
+ e.setChildren(childrens);
|
|
|
+ }
|
|
|
});
|
|
|
// 把数据放回到分页中,结果返回
|
|
|
page.setRecords(collect);
|
|
@@ -206,8 +211,13 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
List<KnowledgeCategoryAdminVo> knowledgeCategories = knowledgeCategorieChild.stream().sorted(Comparator.comparingInt(KnowledgeCategoryAdminVo::getSort)).collect(Collectors.toList());
|
|
|
knowledgeCategoryAdminVo.setChildren(knowledgeCategories);
|
|
|
knowledgeCategories.forEach(e -> {
|
|
|
+ e.setLevel(knowledgeCategoryAdminVo.getLevel() + 1);
|
|
|
List<KnowledgeCategoryAdminVo> allChildren = findChildrens(e);
|
|
|
- e.setChildren(allChildren);
|
|
|
+ if (allChildren.size() == 0){
|
|
|
+ e.setChildren(null);
|
|
|
+ } else {
|
|
|
+ e.setChildren(allChildren);
|
|
|
+ }
|
|
|
});
|
|
|
return knowledgeCategories;
|
|
|
}
|