Interface OAuth2DeviceRepository

All Superinterfaces:
cn.herodotus.engine.data.core.jpa.repository.BaseJpaRepository<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.jpa.repository.BaseJpaRepository<OAuth2Device,String>

Description: OAuth2DeviceRepository

Author:
: gengwei.zheng
Date:
: 2023/5/15 16:14
  • Nested Class Summary

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

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

    Modifier and Type
    Method
    Description
    int
    activate(String clientId, boolean isActivated)
    激活设备
    根据 Client ID 查询 OAuth2Device

    Methods inherited from interface cn.herodotus.engine.data.core.jpa.repository.BaseJpaRepository

    count, count, deleteById, findAll, findAll, findAll, findAll, findAll, findAll, findAllById, findById, findOne, getReferenceById

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

    delete, deleteAll, deleteAll, deleteAllById, existsById, save

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

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

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

    delete, exists, findAll, findBy

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

    saveAll

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

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

    • findByClientId

      OAuth2Device findByClientId(String clientId)
      根据 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 - 可区分客户端身份的ID
      isActivated - 是否已激活
      Returns:
      影响数据条目