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 TypeMethodDescriptionlongcountByUserIdAndReadFalse(String userId) 某使用者未讀數findByIdAndUserId(UUID id, String userId) 取某使用者的單則(標記已讀前的安全查詢,確保歸屬)findByUserIdAndReadFalse(String userId) 某使用者所有未讀(供標記全部已讀)org.springframework.data.domain.Page<T> findByUserIdOrderByCreatedDateDesc(String userId, org.springframework.data.domain.Pageable pageable) 某使用者的通知(新到舊);租戶範圍由@TenantIdfilter 自動限縮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.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
-
findByUserIdOrderByCreatedDateDesc
-
countByUserIdAndReadFalse
某使用者未讀數 -
findByIdAndUserId
-
findByUserIdAndReadFalse
-