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; // (조회한 결과 개수 > 요청한 페이지 사이즈) 이면 뒤에 데이터가 더 존재함