|
@@ -82,7 +82,7 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
if (knowledgeCategory != null) {
|
|
|
BeanUtils.copyProperties(knowledgeCategory, knowledgeCategoryAdminVo);
|
|
|
}
|
|
|
- List<KnowledgeCategoryAdminVo> childrens = findChildrens(knowledgeCategoryAdminVo);
|
|
|
+ List<KnowledgeCategoryAdminVo> childrens = findChildrens(knowledgeCategoryAdminVo,null);
|
|
|
knowledgeCategoryAdminVo.setChildren(childrens);
|
|
|
return knowledgeCategoryAdminVo;
|
|
|
}
|
|
@@ -95,6 +95,8 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
*/
|
|
|
public IPage findAllKnowledgeCategory(QueryFilter filter) {
|
|
|
Map<String, Object> params = PageHelper.constructParams(filter);
|
|
|
+ String userId = userService.queryLoginUser();
|
|
|
+ filter.getParams().put("userId",userId);
|
|
|
IPage page = knowledgeCategoryMapper.findAllKnowledgeCategory(filter.getPage(), filter.getParams(), params);
|
|
|
List<KnowledgeCategoryAdminVo> knowledgeCategoryList = page.getRecords();
|
|
|
// 如果有name参数,特殊处理
|
|
@@ -105,7 +107,7 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
knowledgeCategoryList.forEach(e -> {
|
|
|
e.setLevel(1);
|
|
|
e.setOperatorName(userService.queryUser(e.getUpdateBy()).getFullName());
|
|
|
- List<KnowledgeCategoryAdminVo> childrens = findChildrens(e);
|
|
|
+ List<KnowledgeCategoryAdminVo> childrens = findChildrens(e,userId);
|
|
|
if (childrens.size() == 0) {
|
|
|
e.setChildren(null);
|
|
|
} else {
|
|
@@ -125,7 +127,7 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
knowledgeCategoryList.forEach(e -> {
|
|
|
e.setLevel(1);
|
|
|
e.setOperatorName(userService.queryUser(e.getUpdateBy()).getFullName());
|
|
|
- List<KnowledgeCategoryAdminVo> childrens = findChildrens(e);
|
|
|
+ List<KnowledgeCategoryAdminVo> childrens = findChildrens(e,userId);
|
|
|
if (childrens.size() == 0) {
|
|
|
e.setChildren(null);
|
|
|
} else {
|
|
@@ -282,8 +284,8 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
}
|
|
|
|
|
|
// 查询孩子节点(递归)
|
|
|
- public List<KnowledgeCategoryAdminVo> findChildrens(KnowledgeCategoryAdminVo knowledgeCategoryAdminVo) {
|
|
|
- List<KnowledgeCategoryAdminVo> knowledgeCategorieChild = knowledgeCategoryMapper.selectKnowledgeCategoryByParent(knowledgeCategoryAdminVo.getPkId());
|
|
|
+ public List<KnowledgeCategoryAdminVo> findChildrens(KnowledgeCategoryAdminVo knowledgeCategoryAdminVo,String userId) {
|
|
|
+ List<KnowledgeCategoryAdminVo> knowledgeCategorieChild = knowledgeCategoryMapper.selectKnowledgeCategoryByParent(knowledgeCategoryAdminVo.getPkId(),userId);
|
|
|
List<KnowledgeCategoryAdminVo> knowledgeCategories = knowledgeCategorieChild.stream().
|
|
|
sorted(Comparator.comparingInt(KnowledgeCategoryAdminVo::getSort)).
|
|
|
map(e -> {
|
|
@@ -294,7 +296,7 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
knowledgeCategoryAdminVo.setChildren(knowledgeCategories);
|
|
|
knowledgeCategories.forEach(e -> {
|
|
|
e.setLevel(knowledgeCategoryAdminVo.getLevel() + 1);
|
|
|
- List<KnowledgeCategoryAdminVo> allChildren = findChildrens(e);
|
|
|
+ List<KnowledgeCategoryAdminVo> allChildren = findChildrens(e,userId);
|
|
|
if (allChildren.size() == 0) {
|
|
|
e.setChildren(null);
|
|
|
} else {
|
|
@@ -390,7 +392,7 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
// 查询其孩子节点
|
|
|
collect.forEach(e -> {
|
|
|
e.setLevel(1);
|
|
|
- List<KnowledgeCategoryAdminVo> childrens = findChildrens(e);
|
|
|
+ List<KnowledgeCategoryAdminVo> childrens = findChildrens(e,null);
|
|
|
e.setChildren(childrens);
|
|
|
});
|
|
|
return collect;
|