Skip to content

Commit

Permalink
[hotfix] groupEntity와 memberEntity 간 조인 조건 명확히 하여 groupCode 관련 경로 표현식…
Browse files Browse the repository at this point in the history
… 오류 해결
  • Loading branch information
chahyunsoo committed Oct 10, 2024
1 parent 57a7a84 commit 678875b
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,27 @@ public Page<Post> findAllByBoardIdAndGroupCodeAndMemberCode(Long boardId, GroupC
.where(whereClause)
.orderBy(postEntity.createdAt.desc());


List<PostEntity> content = query
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.fetch();

// JPAQuery<Long> countQuery = queryFactory
// .select(postEntity.count())
// .from(postEntity)
// .where(whereClause);

JPAQuery<Long> countQuery = queryFactory
.select(postEntity.count())
.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);


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

0 comments on commit 678875b

Please sign in to comment.