From 9ddf2e2be381b996cd2f92aacec6c87514e894ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A3=BC=EC=98=81?= Date: Thu, 5 Oct 2023 22:35:03 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EC=A0=84=EC=B2=B4=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=20=EC=A1=B0=ED=9A=8C,=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EB=B3=84=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C?= =?UTF-8?q?=20status=203=20=EC=95=84=EB=8B=8C=EA=B2=83=EB=A7=8C=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/blow/server/api/repository/PostRepository.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/blow/server/api/repository/PostRepository.java b/src/main/java/com/blow/server/api/repository/PostRepository.java index fa0dde7..bdd24cc 100644 --- a/src/main/java/com/blow/server/api/repository/PostRepository.java +++ b/src/main/java/com/blow/server/api/repository/PostRepository.java @@ -10,7 +10,11 @@ public interface PostRepository extends JpaRepository { Optional getPostById(Long postId); - List findPostByCategoryOrderByCreatedAtDesc(String category); + + @Query("SELECT p FROM Post p WHERE p.status != 3 ORDER BY p.createdAt DESC") + List findAll(); + @Query("SELECT p FROM Post p WHERE LOWER(p.category) LIKE %:category% and p.status != 3 ORDER BY p.createdAt DESC") + List findPostByCategoryOrderByCreatedAtDesc( @Param("category") String category); List 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 findAllByKeyword(