接口 OAuth2DeviceRepository

所有超级接口:
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

作者:
: gengwei.zheng
Date:
: 2023/5/15 16:14
  • 方法概要

    修饰符和类型
    方法
    说明
    int
    activate(String clientId, boolean isActivated)
    激活设备
    根据 Client ID 查询 OAuth2Device

    从接口继承的方法 cn.herodotus.engine.data.core.repository.BaseRepository

    count, count, deleteById, findAll, findAll, findAll, findAll, findAll, findAll, findById, findOne

    从接口继承的方法 org.springframework.data.repository.CrudRepository

    delete, deleteAll, deleteAll, deleteAllById, existsById, save

    从接口继承的方法 org.springframework.data.jpa.repository.JpaRepository

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

    从接口继承的方法 org.springframework.data.jpa.repository.JpaSpecificationExecutor

    delete, exists, findBy

    从接口继承的方法 org.springframework.data.repository.ListCrudRepository

    findAllById, saveAll

    从接口继承的方法 org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • 方法详细资料

    • findByClientId

      OAuth2Device findByClientId(String clientId)
      根据 Client ID 查询 OAuth2Device
      参数:
      clientId - OAuth2Device 中的 clientId
      返回:
      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会以更新类语句来执行,而不再是以查询语句执行。

      参数:
      clientId - 可区分客户端身份的ID
      isActivated - 是否已激活
      返回:
      影响数据条目