CommentRepo.java 885 B

1234567891011121314151617181920212223242526
  1. package com.izouma.jmrh.repo;
  2. import com.izouma.jmrh.domain.Comment;
  3. import org.springframework.data.jpa.repository.JpaRepository;
  4. import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
  5. import org.springframework.data.jpa.repository.Modifying;
  6. import org.springframework.data.jpa.repository.Query;
  7. import javax.annotation.Nonnull;
  8. import javax.transaction.Transactional;
  9. import java.util.List;
  10. public interface CommentRepo extends JpaRepository<Comment, Long>, JpaSpecificationExecutor<Comment> {
  11. @Query("update Comment c set c.del = true where c.id = ?1")
  12. @Transactional
  13. @Modifying
  14. void deleteById(@Nonnull Long id);
  15. List<Comment> findByPostIdIn(Iterable<Long> postIds);
  16. @Query("select distinct c.postId from Comment c where c.userId = ?1")
  17. List<Long> findUserReplyPostId(Long userId);
  18. Comment findFirstByPostId(Long postId);
  19. }