Skip to content

Commit

Permalink
fix : groupMemberCount
Browse files Browse the repository at this point in the history
  • Loading branch information
devYSK committed Jul 6, 2024
1 parent d82c6ba commit f38d701
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.querydsl.core.Tuple;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.jpa.JPAExpressions;
import com.querydsl.jpa.impl.JPAQueryFactory;

import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -163,7 +165,13 @@ public BookGroupResponses findAllByUser(BookGroupSearchRequest request, Long use
bookGroup.hasJoinPasswd.as("hasJoinPasswd"),
bookGroup.isPublic.as("isPublic"),

groupMember.countDistinct().as("memberCount"),
// groupMember.countDistinct().as("memberCount"),
Expressions.as(
JPAExpressions.select(groupMember.countDistinct())
.from(groupMember)
.where(groupMember.bookGroup.id.eq(bookGroup.id)),
"memberCount"
),
groupComment.countDistinct().as("commentCount"),
Projections.constructor(BookGroupResponse.BookResponse.class,
book.id.as("bookId"),
Expand Down

0 comments on commit f38d701

Please sign in to comment.