Interface RoleRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Role,String>, org.springframework.data.jpa.repository.JpaRepository<Role,String>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Role>, org.springframework.data.repository.ListCrudRepository<Role,String>, org.springframework.data.repository.ListPagingAndSortingRepository<Role,String>, org.springframework.data.repository.PagingAndSortingRepository<Role,String>, org.springframework.data.repository.query.QueryByExampleExecutor<Role>, org.springframework.data.repository.Repository<Role,String>

@Repository @NullMarked public interface RoleRepository extends org.springframework.data.jpa.repository.JpaRepository<Role,String>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Role>

角色数据访问层接口

角色 进行数据库操作的 JPA 接口。 继承 JpaRepositoryJpaSpecificationExecutor, 提供基础的CRUD操作和动态查询能力。 同时支持角色树形结构相关的查询操作。

Author:
xezzon
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor

    org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    根据父角色ID集合查询子角色
    根据角色编码查询角色
    根据角色编码集合批量查询角色

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor

    count, count, delete, delete, exists, exists, findAll, findAll, findAll, findAll, findAll, findBy, findBy, findOne, findOne, update

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findByValue

      Optional<Role> findByValue(String value)
      根据角色编码查询角色
      Parameters:
      value - 角色编码(完整路径,如:ADMIN/SYSTEM/USER)
      Returns:
      角色对象(如果存在)
    • findByParentIdIn

      List<Role> findByParentIdIn(Collection<String> parentIds)
      根据父角色ID集合查询子角色
      Parameters:
      parentIds - 父角色ID集合
      Returns:
      匹配的子角色列表
    • findByValueIn

      List<Role> findByValueIn(Collection<String> values)
      根据角色编码集合批量查询角色
      Parameters:
      values - 角色编码集合
      Returns:
      角色列表,按照传入的编码顺序返回