|
@@ -198,6 +198,11 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
@CacheEvict(value = {"knowledgeCategory","knowledgeCategoryPc"}, allEntries=true,cacheManager = "redisCacheManager")
|
|
|
public int update(KnowledgeCategory entity) {
|
|
|
KnowledgeCategory knowledgeCategory = this.get(entity.getPkId());
|
|
|
+ //判断是否能进行修改(创建人或维护人满足一个即可修改)
|
|
|
+ String userId = userService.queryLoginUser();
|
|
|
+ if (!userId.equals(knowledgeCategory.getCreateBy()) && !userId.equals(knowledgeCategory.getMaintainer())){
|
|
|
+ throw new RuntimeException("您没有权限进行此操作");
|
|
|
+ }
|
|
|
if (knowledgeCategory.getIsSys() == 1) {
|
|
|
throw new RuntimeException("系统内置节点,无法修改");
|
|
|
}
|
|
@@ -252,14 +257,18 @@ public class KnowledgeCategoryServiceImpl extends SuperServiceImpl<KnowledgeCate
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@CacheEvict(value = {"knowledgeCategory","knowledgeCategoryPc"}, allEntries=true,cacheManager = "redisCacheManager")
|
|
|
public Integer deleteKnowledgeCategory(String knowledgeCategoryId) {
|
|
|
-
|
|
|
+ KnowledgeCategory knowledgeCategory = this.baseMapper.selectById(knowledgeCategoryId);
|
|
|
+ //判断是否能进行修改(创建人或维护人满足一个即可修改)
|
|
|
+ String userId = userService.queryLoginUser();
|
|
|
+ if (!userId.equals(knowledgeCategory.getCreateBy()) && !userId.equals(knowledgeCategory.getMaintainer())){
|
|
|
+ throw new RuntimeException("您没有权限进行此操作");
|
|
|
+ }
|
|
|
// 查询该分类下是否还有知识
|
|
|
Boolean hasKnowledge = hasKnowledge(knowledgeCategoryId);
|
|
|
if (hasKnowledge) {
|
|
|
return 0;
|
|
|
}
|
|
|
// 查询该分类的下是否还有子分类
|
|
|
- KnowledgeCategory knowledgeCategory = this.baseMapper.selectById(knowledgeCategoryId);
|
|
|
Boolean hasChirld = findHasChirld(knowledgeCategory);
|
|
|
if (hasChirld) {
|
|
|
return 1;
|