Class RoleService

java.lang.Object
io.github.xezzon.zeroweb.role.internal.RoleService
All Implemented Interfaces:
io.github.xezzon.zeroweb.core.tree.ITreeService<Role,String>, IRoleService4Auth

@Service public class RoleService extends Object implements io.github.xezzon.zeroweb.core.tree.ITreeService<Role,String>, IRoleService4Auth

角色服务实现类

RoleService 提供角色管理的业务逻辑实现。 它同时实现了 ITreeService 以支持树形结构相关的查询, 以及 IRoleService4Auth 为认证模块提供角色相关服务。

Author:
xezzon
  • Constructor Details

    • RoleService

      public RoleService(RoleRepository roleRepository)
      依赖注入
      Parameters:
      roleRepository - 角色数据访问层
  • Method Details

    • listByParentId

      public List<Role> listByParentId(Collection<String> parentIds)
      Specified by:
      listByParentId in interface io.github.xezzon.zeroweb.core.tree.ITreeService<Role,String>
    • findByIdIn

      public List<Role> findByIdIn(Collection<String> roleIds)
      Description copied from interface: IRoleService4Auth
      根据ID批量查询角色
      Specified by:
      findByIdIn in interface IRoleService4Auth
      Parameters:
      roleIds - 角色ID集合,不能为空
      Returns:
      角色列表,按照传入的ID顺序返回,如果角色不存在则跳过
    • findParent

      public Optional<Role> findParent(String childId)
      Description copied from interface: IRoleService4Auth
      查询上级角色
      Specified by:
      findParent in interface IRoleService4Auth
      Parameters:
      childId - 角色ID,不能为空
      Returns:
      上级角色,如果角色不存在或为根节点则返回空
    • topDownList

      public List<Role> topDownList(Collection<String> initial)
      Description copied from interface: IRoleService4Auth
      查询角色子级列表
      Specified by:
      topDownList in interface IRoleService4Auth
      Parameters:
      initial - 初始角色ID集合,从这些角色开始向下查找
      Returns:
      该角色的所有子级角色(包含递归子级,但不包括自身),按层级排序