From f0206e687fcfbd377652869d80cd5bb3402000d6 Mon Sep 17 00:00:00 2001 From: RyuKwanKon Date: Wed, 3 Jan 2024 21:27:13 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20#17=20=EA=B8=B0=EB=B3=B8=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=20=EC=A1=B0=ED=9A=8C=20=EC=BF=BC=EB=A6=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/PostQuerydslRepository.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/org/gachon/checkmate/domain/post/repository/PostQuerydslRepository.java b/src/main/java/org/gachon/checkmate/domain/post/repository/PostQuerydslRepository.java index c62ec9e..8158e65 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/repository/PostQuerydslRepository.java +++ b/src/main/java/org/gachon/checkmate/domain/post/repository/PostQuerydslRepository.java @@ -24,6 +24,29 @@ public class PostQuerydslRepository { private final JPAQueryFactory queryFactory; + public Page findAllPosts(Pageable pageable) { + List content = queryFactory + .select(new QPostSearchDto( + post.title, + post.content, + post.importantKeyType, + post.similarityKeyType, + post.endDate, + post.scrapList.size(), + postCheckList + )) + .from(post) + .leftJoin(post.postCheckList, postCheckList) + .where( + validatePostDate() + ) + .fetch(); + + JPAQuery countQuery = queryFactory + .selectFrom(post); + return PageableExecutionUtils.getPage(content, pageable, countQuery::fetchCount); + } + public Page searchKeyPost(ImportantKeyType importantKeyType, Pageable pageable) { List content = queryFactory .select(new QPostSearchDto(