Skip to content

Commit

Permalink
fix : 전체 게시글 조회, 카테고리 별 조회 시 status 3 아닌것만 출력
Browse files Browse the repository at this point in the history
  • Loading branch information
kjy-asl committed Oct 5, 2023
1 parent 47eeeca commit 9ddf2e2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

public interface PostRepository extends JpaRepository<Post, Long> {
Optional<Post> getPostById(Long postId);
List<Post> findPostByCategoryOrderByCreatedAtDesc(String category);

@Query("SELECT p FROM Post p WHERE p.status != 3 ORDER BY p.createdAt DESC")
List<Post> findAll();
@Query("SELECT p FROM Post p WHERE LOWER(p.category) LIKE %:category% and p.status != 3 ORDER BY p.createdAt DESC")
List<Post> findPostByCategoryOrderByCreatedAtDesc( @Param("category") String category);
List<Post> findAllByUserIdOrderByCreatedAtDesc(Long userId);
@Query("SELECT p FROM Post p WHERE LOWER(p.title) LIKE %:postTitleKeyword% OR LOWER(p.content) LIKE %:postContentKeyword% ORDER BY p.createdAt DESC")
List<Post> findAllByKeyword(
Expand Down

0 comments on commit 9ddf2e2

Please sign in to comment.