Skip to content

Commit

Permalink
feat: 경품이벤트 전체 응모자수 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
swa07016 committed Aug 15, 2024
1 parent 000faed commit 4f81514
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,22 @@ public PrizeEventResponseDTO.PrizeList findPrizeListDTO(Long eventId) {

Long memberId = memberUtils.getCurrentMemberId();

JPQLQuery<Long> actualParticipantCountQuery =
JPAExpressions.select(qPrizeEntry.memberId.countDistinct())
.from(qPrizeEntry)
.where(qPrizeEntry.prize.id.eq(qPrize.id));

JPQLQuery<Long> totalParticipantCountQuery =
new JPAQuery<Long>().select(Expressions.constant(414L));
new JPAQuery<Long>()
.select(
Expressions.cases()
.when(actualParticipantCountQuery.eq(0L))
.then(Expressions.constant(414L))
.otherwise(
Expressions.numberTemplate(
Long.class,
"414 + {0}",
actualParticipantCountQuery)));

JPQLQuery<Long> myEntryCountQuery =
JPAExpressions.select(qPrizeEntry.id.count())
Expand Down

0 comments on commit 4f81514

Please sign in to comment.