Interface OAuth2DeviceRepository
- All Superinterfaces:
cn.herodotus.engine.data.core.repository.BaseRepository<OAuth2Device,,String> org.springframework.data.repository.CrudRepository<OAuth2Device,,String> org.springframework.data.jpa.repository.JpaRepository<OAuth2Device,,String> org.springframework.data.jpa.repository.JpaSpecificationExecutor<OAuth2Device>,org.springframework.data.repository.ListCrudRepository<OAuth2Device,,String> org.springframework.data.repository.ListPagingAndSortingRepository<OAuth2Device,,String> org.springframework.data.repository.PagingAndSortingRepository<OAuth2Device,,String> org.springframework.data.repository.query.QueryByExampleExecutor<OAuth2Device>,org.springframework.data.repository.Repository<OAuth2Device,String>
public interface OAuth2DeviceRepository
extends cn.herodotus.engine.data.core.repository.BaseRepository<OAuth2Device,String>
Description: OAuth2DeviceRepository
- Author:
- : gengwei.zheng
- Date:
- : 2023/5/15 16:14
-
Method Summary
Modifier and TypeMethodDescriptionint激活设备findByClientId(String clientId) 根据 Client ID 查询 OAuth2DeviceMethods inherited from interface cn.herodotus.engine.data.core.repository.BaseRepository
count, count, deleteById, findAll, findAll, findAll, findAll, findAll, findAll, findById, findOneMethods inherited from interface org.springframework.data.repository.CrudRepository
delete, deleteAll, deleteAll, deleteAllById, existsById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
delete, exists, findByMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAllById, saveAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByClientId
根据 Client ID 查询 OAuth2Device- Parameters:
clientId- OAuth2Device 中的 clientId- Returns:
OAuth2Device
-
activate
@Modifying @Query("update OAuth2Device d set d.activated = ?2 where d.clientId = ?1") int activate(String clientId, boolean isActivated) 激活设备更新设备是否激活的状态
1.@Query注解来将自定义sql语句绑定到自定义方法上。 2.@Modifying注解来标注只需要绑定参数的自定义的更新类语句(更新、插入、删除)。 3.@Modifying只与@Query联合使用,派生类的查询方法和自定义的方法不需要此注解。 4.@Modifying注解时,JPA会以更新类语句来执行,而不再是以查询语句执行。
- Parameters:
clientId- 可区分客户端身份的IDisActivated- 是否已激活- Returns:
- 影响数据条目
-