Package com.bytedesk.core.push
Interface PushRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<PushEntity,,Long> org.springframework.data.jpa.repository.JpaRepository<PushEntity,,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<PushEntity>,org.springframework.data.repository.ListCrudRepository<PushEntity,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<PushEntity,,Long> org.springframework.data.repository.PagingAndSortingRepository<PushEntity,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<PushEntity>,org.springframework.data.repository.Repository<PushEntity,Long>
public interface PushRepository
extends org.springframework.data.jpa.repository.JpaRepository<PushEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<PushEntity>
-
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 TypeMethodDescriptionexistsByStatusAndTypeAndReceiver(String status, String type, String receiver) existsByStatusAndTypeAndReceiverAndContent(String status, String type, String receiver, String content) intexpireByTypeBefore(String type, ZonedDateTime before, String oldStatus, String newStatus) DB 兜底:过期扫码登录(PENDING 且 updatedAt 早于阈值)。intexpireNotTypeBefore(String type, ZonedDateTime before, String oldStatus, String newStatus) DB 兜底:过期非扫码登录的验证码(PENDING 且 updatedAt 早于阈值)。findByDeviceUidAndContent(String deviceUid, String code) findByStatus(String status) findByStatusAndReceiverAndContent(String status, String receiver, String content) findTopByDeviceUidAndStatusAndTypeOrderByUpdatedAtDesc(String deviceUid, String status, String type) intupdateStatusByUidsAndStatus(List<String> uids, String oldStatus, String newStatus) 将一批 UID 的状态从 oldStatus 更新为 newStatus(用于 Redis 过期批处理)。Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, 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
count, delete, exists, findAll, findAll, findAll, findAll, findBy, findOneMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByUid
-
findByStatus
-
findByStatusAndReceiverAndContent
Optional<PushEntity> findByStatusAndReceiverAndContent(String status, String receiver, String content) -
findTopByDeviceUidAndStatusAndTypeOrderByUpdatedAtDesc
Optional<PushEntity> findTopByDeviceUidAndStatusAndTypeOrderByUpdatedAtDesc(String deviceUid, String status, String type) -
findByDeviceUidAndContent
-
existsByStatusAndTypeAndReceiver
-
existsByStatusAndTypeAndReceiverAndContent
-
updateStatusByUidsAndStatus
@Modifying @Query("update PushEntity p set p.status = :newStatus where p.uid in :uids and p.status = :oldStatus") int updateStatusByUidsAndStatus(@Param("uids") List<String> uids, @Param("oldStatus") String oldStatus, @Param("newStatus") String newStatus) 将一批 UID 的状态从 oldStatus 更新为 newStatus(用于 Redis 过期批处理)。 -
expireByTypeBefore
@Modifying @Query("update PushEntity p set p.status = :newStatus where p.status = :oldStatus and p.type = :type and p.updatedAt < :before") int expireByTypeBefore(@Param("type") String type, @Param("before") ZonedDateTime before, @Param("oldStatus") String oldStatus, @Param("newStatus") String newStatus) DB 兜底:过期扫码登录(PENDING 且 updatedAt 早于阈值)。 -
expireNotTypeBefore
@Modifying @Query("update PushEntity p set p.status = :newStatus where p.status = :oldStatus and (p.type is null or p.type <> :type) and p.updatedAt < :before") int expireNotTypeBefore(@Param("type") String type, @Param("before") ZonedDateTime before, @Param("oldStatus") String oldStatus, @Param("newStatus") String newStatus) DB 兜底:过期非扫码登录的验证码(PENDING 且 updatedAt 早于阈值)。
-