Interface ApprovedPostRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<ApprovedPost,,Long> org.springframework.data.jpa.repository.JpaRepository<ApprovedPost,,Long> org.springframework.data.repository.ListCrudRepository<ApprovedPost,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<ApprovedPost,,Long> org.springframework.data.repository.PagingAndSortingRepository<ApprovedPost,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<ApprovedPost>,org.springframework.data.repository.Repository<ApprovedPost,Long>
@Repository
public interface ApprovedPostRepository
extends org.springframework.data.jpa.repository.JpaRepository<ApprovedPost,Long>
Repository interface for managing
ApprovedPost entities.
Provides methods to find and delete approved posts based on message IDs.-
Method Summary
Modifier and TypeMethodDescriptiondeleteByMessageIdsIn(List<Integer> messageIds) Deletes all approved posts that contain any of the specified message IDs.findFirstByMessageIdsIn(List<Integer> messageIds) Finds the first approved post that contains any of the specified message IDs.Finds the first approved post ordered by the approval timestamp.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
-
findFirstByOrderByApprovedAt
Optional<ApprovedPost> findFirstByOrderByApprovedAt()Finds the first approved post ordered by the approval timestamp.- Returns:
- an
Optionalcontaining the first approved post, or empty if none found
-
findFirstByMessageIdsIn
Finds the first approved post that contains any of the specified message IDs.- Parameters:
messageIds- a list of message IDs to search for- Returns:
- an
Optionalcontaining the first approved post with matching message IDs, or empty if none found
-
deleteByMessageIdsIn
Deletes all approved posts that contain any of the specified message IDs.- Parameters:
messageIds- a list of message IDs to search for- Returns:
- a list of
ApprovedPostentities that were deleted
-