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>
  • Method Details

    • findByUid

      Optional<PushEntity> findByUid(String uid)
    • findByStatus

      List<PushEntity> findByStatus(String status)
    • findByStatusAndReceiverAndContent

      Optional<PushEntity> findByStatusAndReceiverAndContent(String status, String receiver, String content)
    • findTopByDeviceUidAndStatusAndTypeOrderByUpdatedAtDesc

      Optional<PushEntity> findTopByDeviceUidAndStatusAndTypeOrderByUpdatedAtDesc(String deviceUid, String status, String type)
    • findByDeviceUidAndContent

      Optional<PushEntity> findByDeviceUidAndContent(String deviceUid, String code)
    • existsByStatusAndTypeAndReceiver

      Boolean existsByStatusAndTypeAndReceiver(String status, String type, String receiver)
    • existsByStatusAndTypeAndReceiverAndContent

      Boolean existsByStatusAndTypeAndReceiverAndContent(String status, String type, String receiver, String content)
    • 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 早于阈值)。