Interface ReviewRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Review,,Long> org.springframework.data.repository.Repository<Review,Long>
@Repository
public interface ReviewRepository
extends org.springframework.data.repository.CrudRepository<Review,Long>
The ReviewRepository is a repository for Review entities
-
Method Summary
Modifier and TypeMethodDescriptionlongcountByStatus(ModerationStatus status) longlongfindByItemAndStatus(MenuItem item, ModerationStatus approved) findByReviewer(User user) findByStatus(ModerationStatus moderationStatus) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Method Details
-
findByReviewer
- Parameters:
user-- Returns:
- all reviews that have come from a single reviewer, ex say this user has made a few reviews over the past year well then this method will return only the reviews that this user has sent
-
findByStatus
-
findByItemAndStatus
-
countByStatus
@Query("SELECT COUNT(r) FROM reviews r WHERE r.status = :status") long countByStatus(@Param("status") ModerationStatus status) -
countDistinctItemsByStatus
@Query("SELECT COUNT(DISTINCT r.item.id) FROM reviews r WHERE r.status = :status") long countDistinctItemsByStatus(@Param("status") ModerationStatus status) -
countDistinctCommonsByStatus
@Query("SELECT COUNT(DISTINCT r.item.diningCommonsCode) FROM reviews r WHERE r.status = :status") long countDistinctCommonsByStatus(@Param("status") ModerationStatus status) -
findMaxDateEditedByStatus
@Query("SELECT MAX(r.dateEdited) FROM reviews r WHERE r.status = :status") LocalDateTime findMaxDateEditedByStatus(@Param("status") ModerationStatus status)
-