添加知识库权限控制功能

This commit is contained in:
violateer
2025-07-20 10:05:38 +08:00
parent 63ec00cd71
commit a99344813f
30 changed files with 1985 additions and 336 deletions

View File

@@ -0,0 +1,15 @@
package org.ruoyi.mapper;
import org.ruoyi.core.mapper.BaseMapperPlus;
import org.ruoyi.domain.KnowledgeRoleGroup;
import org.ruoyi.domain.vo.KnowledgeRoleGroupVo;
/**
* 知识库角色组Mapper接口
*
* @author ageerle
* @date 2025-07-19
*/
public interface KnowledgeRoleGroupMapper extends BaseMapperPlus<KnowledgeRoleGroup, KnowledgeRoleGroupVo> {
}

View File

@@ -0,0 +1,15 @@
package org.ruoyi.mapper;
import org.ruoyi.core.mapper.BaseMapperPlus;
import org.ruoyi.domain.KnowledgeRole;
import org.ruoyi.domain.vo.KnowledgeRoleVo;
/**
* 知识库角色Mapper接口
*
* @author ageerle
* @date 2025-07-19
*/
public interface KnowledgeRoleMapper extends BaseMapperPlus<KnowledgeRole, KnowledgeRoleVo> {
}

View File

@@ -0,0 +1,38 @@
package org.ruoyi.mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.ruoyi.core.mapper.BaseMapperPlus;
import org.ruoyi.domain.KnowledgeRoleRelation;
import org.ruoyi.domain.vo.KnowledgeRoleRelationVo;
import java.util.List;
/**
* 知识库角色与知识库关联Mapper接口
*
* @author ageerle
* @date 2025-07-19
*/
public interface KnowledgeRoleRelationMapper extends BaseMapperPlus<KnowledgeRoleRelation, KnowledgeRoleRelationVo> {
@Select("SELECT knowledge_id FROM knowledge_role_relation WHERE knowledge_role_id = #{knowledgeRoleId}")
List<Long> selectKnowledgeIdsByRoleId(@Param("knowledgeRoleId") Long knowledgeRoleId);
/**
* 根据 roleId 删除所有关联
*/
@Delete("DELETE FROM knowledge_role_relation WHERE knowledge_role_id = #{knowledgeRoleId}")
void deleteByRoleId(@Param("knowledgeRoleId") Long knowledgeRoleId);
@Delete({
"<script>",
"DELETE FROM knowledge_role_relation",
"WHERE knowledge_role_id IN",
"<foreach collection='knowledgeRoleIds' item='id' open='(' separator=',' close=')'>",
"#{id}",
"</foreach>",
"</script>"
})
void deleteByRoleIds(@Param("knowledgeRoleIds") List<Long> knowledgeRoleIds);
}