Skip to content

Commit

Permalink
[hotfix] 페이징 중복 문제 해결, countDistinct
Browse files Browse the repository at this point in the history
* findAllByBoardIdAndGroupCodeAndMemberCode 메소드는 현재 프론트에서 쓰지 않는 메소드이기는 하지만, 함께 수정함(같은 로직이기 때문에)
  • Loading branch information
chahyunsoo committed Oct 28, 2024
1 parent b0613e6 commit 9ad23e4
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,13 @@ public Page<Post> findAllByBoardIdAndGroupCodeAndMemberCode(Long boardId, GroupC
.fetch();

JPAQuery<Long> countQuery = queryFactory
.select(postEntity.count())
.select(postEntity.countDistinct())
.from(postEntity)
.leftJoin(postEntity.userEntity, userEntity)
.leftJoin(memberEntity).on(memberEntity.userEntity.eq(userEntity))
.leftJoin(memberEntity.groupEntity, groupEntity)
.leftJoin(postFileEntity).on(postFileEntity.postEntity.eq(postEntity))
.where(whereClause)
.distinct();
.where(whereClause);

return PageableExecutionUtils.getPage(
content.stream().map(postMapper::toDomain).collect(Collectors.toList()),
Expand Down

0 comments on commit 9ad23e4

Please sign in to comment.