Skip to content

Commit

Permalink
Merge pull request #198 from Nexters/feature/197
Browse files Browse the repository at this point in the history
Feature/197 : 이벤트 응모 인원 수 증가
  • Loading branch information
swa07016 authored Aug 15, 2024
2 parents 000faed + 4f81514 commit 0f4a431
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 0f4a431

Please sign in to comment.