Interface InAppNotificationRepositoryBase<T extends InAppNotificationBase>

Type Parameters:
T - 應用宣告的具體站內信 entity(繼承 InAppNotificationBase
All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,UUID>, org.springframework.data.jpa.repository.JpaRepository<T,UUID>, org.springframework.data.repository.ListCrudRepository<T,UUID>, org.springframework.data.repository.ListPagingAndSortingRepository<T,UUID>, org.springframework.data.repository.PagingAndSortingRepository<T,UUID>, org.springframework.data.repository.query.QueryByExampleExecutor<T>, org.springframework.data.repository.Repository<T,UUID>

@NoRepositoryBean public interface InAppNotificationRepositoryBase<T extends InAppNotificationBase> extends org.springframework.data.jpa.repository.JpaRepository<T,UUID>

站內信資料存取基底(讀取面供 app REST API 使用)

ADR-017:jar 不擁有 具體 @Entity,故本介面為 @NoRepositoryBean 泛型基底,由應用以自己的具體 entity 型參 宣告可注入的 repository(extends InAppNotificationRepositoryBase<AppInAppNotification>)。

租戶範圍不寫在查詢裡(ADR-017 決策三):衍生查詢一律不帶 tenantId——tenant 專案的應用 entity 帶 @TenantId,Hibernate 於 Session 建構時自動加租戶條件(applyToLoadByKey = true); ownership 專案無此欄位、天然全域。故同一份查詢在兩種模式下範圍皆正確,jar 無須知道租戶。

Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    某使用者未讀數
    取某使用者的單則(標記已讀前的安全查詢,確保歸屬)
    某使用者所有未讀(供標記全部已讀)
    org.springframework.data.domain.Page<T>
    findByUserIdOrderByCreatedDateDesc(String userId, org.springframework.data.domain.Pageable pageable)
    某使用者的通知(新到舊);租戶範圍由 @TenantId filter 自動限縮

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

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

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

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

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

    findAll, findAllById, saveAll

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

    findAll

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

    findAll

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

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

    • findByUserIdOrderByCreatedDateDesc

      org.springframework.data.domain.Page<T> findByUserIdOrderByCreatedDateDesc(String userId, org.springframework.data.domain.Pageable pageable)
      某使用者的通知(新到舊);租戶範圍由 @TenantId filter 自動限縮
    • countByUserIdAndReadFalse

      long countByUserIdAndReadFalse(String userId)
      某使用者未讀數
    • findByIdAndUserId

      Optional<T> findByIdAndUserId(UUID id, String userId)
      取某使用者的單則(標記已讀前的安全查詢,確保歸屬)
    • findByUserIdAndReadFalse

      List<T> findByUserIdAndReadFalse(String userId)
      某使用者所有未讀(供標記全部已讀)