|
@@ -226,13 +226,15 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
KnowledgeCategory knowledgeCategory = this.get(entity.getPkId());
|
|
|
//判断是否能进行修改(创建人或维护人满足一个即可修改)
|
|
|
String userId = userService.queryLoginUser();
|
|
|
- if (!userId.equals(knowledgeCategory.getCreateBy())){
|
|
|
- throw new RuntimeException("您没有权限进行此操作");
|
|
|
- }
|
|
|
+ //创建人校验
|
|
|
+ boolean createbybol = userId.equals(knowledgeCategory.getCreateBy());
|
|
|
+ //维护人校验
|
|
|
+ boolean maintainerbol = false;
|
|
|
if (StringUtils.isNotEmpty(knowledgeCategory.getMaintainer())){
|
|
|
- if (!Arrays.asList(knowledgeCategory.getMaintainer().split(",")).contains(userId)){
|
|
|
- throw new RuntimeException("您没有权限进行此操作");
|
|
|
- }
|
|
|
+ maintainerbol = Arrays.asList(knowledgeCategory.getMaintainer().split(",")).contains(userId);
|
|
|
+ }
|
|
|
+ if (!createbybol && !maintainerbol){
|
|
|
+ throw new RuntimeException("您没有权限进行此操作");
|
|
|
}
|
|
|
if (knowledgeCategory.getIsSys() == 1) {
|
|
|
throw new RuntimeException("系统内置节点,无法修改");
|
|
@@ -291,13 +293,15 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
KnowledgeCategory knowledgeCategory = this.baseMapper.selectById(knowledgeCategoryId);
|
|
|
//判断是否能进行修改(创建人或维护人满足一个即可修改)
|
|
|
String userId = userService.queryLoginUser();
|
|
|
- if (!userId.equals(knowledgeCategory.getCreateBy())){
|
|
|
- throw new RuntimeException("您没有权限进行此操作");
|
|
|
- }
|
|
|
+ //创建人校验
|
|
|
+ boolean createbybol = userId.equals(knowledgeCategory.getCreateBy());
|
|
|
+ //维护人校验
|
|
|
+ boolean maintainerbol = false;
|
|
|
if (StringUtils.isNotEmpty(knowledgeCategory.getMaintainer())){
|
|
|
- if (!Arrays.asList(knowledgeCategory.getMaintainer().split(",")).contains(userId)){
|
|
|
- throw new RuntimeException("您没有权限进行此操作");
|
|
|
- }
|
|
|
+ maintainerbol = Arrays.asList(knowledgeCategory.getMaintainer().split(",")).contains(userId);
|
|
|
+ }
|
|
|
+ if (!createbybol && !maintainerbol){
|
|
|
+ throw new RuntimeException("您没有权限进行此操作");
|
|
|
}
|
|
|
// 查询该分类下是否还有知识
|
|
|
Boolean hasKnowledge = hasKnowledge(knowledgeCategoryId);
|