From c239b088eadb0df04e719ccc244d782979c22b54 Mon Sep 17 00:00:00 2001 From: strongmhk Date: Sat, 17 Aug 2024 15:26:13 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20[#97]=20fix:=20checkLastPage=20?= =?UTF-8?q?=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=EC=99=80=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=20=ED=83=80=EC=9E=85=20=EC=97=90=EB=9F=AC=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommunityPostQueryDslRepositoryImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/gaji/service/domain/post/repository/CommunityPostQueryDslRepositoryImpl.java b/src/main/java/gaji/service/domain/post/repository/CommunityPostQueryDslRepositoryImpl.java index 3d400b04..d0675c8f 100644 --- a/src/main/java/gaji/service/domain/post/repository/CommunityPostQueryDslRepositoryImpl.java +++ b/src/main/java/gaji/service/domain/post/repository/CommunityPostQueryDslRepositoryImpl.java @@ -76,12 +76,12 @@ public CommnuityPost findByIdFetchJoinWithUser(Long postId) { @Override public Slice findAllPostsByUser(User user, LocalDateTime cursorDateTime, Pageable pageable, PostTypeEnum type) { - List userPosts = jpaQueryFactory.select(post.id, post.user, post.title, post.body, post.type, post.status, post.hit, post.likeCnt, post.createdAt) - .from(post) - .where(post.user.eq(user), (postTypeEq(type)) - ,(post.createdAt.before(cursorDateTime)) + List userPosts = jpaQueryFactory.select(commnuityPost.id, commnuityPost.user, commnuityPost.title, commnuityPost.body, commnuityPost.type, commnuityPost.status, commnuityPost.hit, commnuityPost.likeCnt, commnuityPost.createdAt) + .from(commnuityPost) + .where(commnuityPost.user.eq(user), (postTypeEq(type)) + ,(commnuityPost.createdAt.before(cursorDateTime)) ) - .orderBy(post.createdAt.desc()) + .orderBy(commnuityPost.createdAt.desc()) .limit(pageable.getPageSize() + 1) .fetch(); @@ -125,7 +125,7 @@ private BooleanExpression searchKeyword(String keyword) { : null; } - private Slice checkLastPage(Pageable pageable, List postList) { + private Slice checkLastPage(Pageable pageable, List postList) { boolean hasNext = false; // (조회한 결과 개수 > 요청한 페이지 사이즈) 이면 뒤에 데이터가 더 존재함