Merge pull request '콘텐츠 랭킹 - 후원 랭킹 조회 로직 수정' (#65) from test into main
Reviewed-on: #65
This commit is contained in:
		| @@ -2,7 +2,6 @@ package kr.co.vividnext.sodalive.content | ||||
|  | ||||
| import com.querydsl.core.types.dsl.Expressions | ||||
| import com.querydsl.jpa.impl.JPAQueryFactory | ||||
| import kr.co.vividnext.sodalive.can.use.QUseCan.useCan | ||||
| import kr.co.vividnext.sodalive.content.QAudioContent.audioContent | ||||
| import kr.co.vividnext.sodalive.content.QBundleAudioContent.bundleAudioContent | ||||
| import kr.co.vividnext.sodalive.content.comment.QAudioContentComment.audioContentComment | ||||
| @@ -19,6 +18,7 @@ import kr.co.vividnext.sodalive.content.main.curation.QAudioContentCuration.audi | ||||
| import kr.co.vividnext.sodalive.content.order.QOrder.order | ||||
| import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme | ||||
| import kr.co.vividnext.sodalive.event.QEvent.event | ||||
| import kr.co.vividnext.sodalive.member.MemberRole | ||||
| import kr.co.vividnext.sodalive.member.QMember.member | ||||
| import org.springframework.data.jpa.repository.JpaRepository | ||||
| import org.springframework.stereotype.Repository | ||||
| @@ -451,10 +451,10 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | ||||
|         sortType: String | ||||
|     ): List<GetAudioContentRankingItem> { | ||||
|         var where = audioContent.isActive.isTrue | ||||
|             .and(audioContent.member.id.ne(648)) | ||||
|             .and(audioContent.member.isNotNull) | ||||
|             .and(audioContent.duration.isNotNull) | ||||
|             .and(audioContent.member.isActive.isTrue) | ||||
|             .and(audioContent.member.isNotNull) | ||||
|             .and(audioContent.member.role.eq(MemberRole.CREATOR)) | ||||
|             .and(audioContent.duration.isNotNull) | ||||
|             .and(audioContentTheme.isActive.isTrue) | ||||
|  | ||||
|         if (!isAdult) { | ||||
| @@ -478,17 +478,19 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | ||||
|         select = when (sortType) { | ||||
|             "후원" -> { | ||||
|                 select | ||||
|                     .from(useCan) | ||||
|                     .innerJoin(useCan.audioContent, audioContent) | ||||
|                     .innerJoin(audioContent.member, member) | ||||
|                     .innerJoin(audioContent.theme, audioContentTheme) | ||||
|                     .from(audioContentComment) | ||||
|                     .innerJoin(audioContentComment.audioContent, audioContent) | ||||
|                     .innerJoin(audioContentComment.audioContent.member, member) | ||||
|                     .innerJoin(audioContentComment.audioContent.theme, audioContentTheme) | ||||
|                     .where( | ||||
|                         where | ||||
|                             .and(useCan.createdAt.goe(startDate)) | ||||
|                             .and(useCan.createdAt.lt(endDate)) | ||||
|                             .and(audioContentComment.isActive.isTrue) | ||||
|                             .and(audioContentComment.donationCan.gt(0)) | ||||
|                             .and(audioContentComment.createdAt.goe(startDate)) | ||||
|                             .and(audioContentComment.createdAt.lt(endDate)) | ||||
|                     ) | ||||
|                     .groupBy(audioContent.id) | ||||
|                     .orderBy(useCan.can.add(useCan.rewardCan).sum().desc(), audioContent.createdAt.asc()) | ||||
|                     .orderBy(audioContentComment.donationCan.sum().desc(), audioContent.createdAt.asc()) | ||||
|             } | ||||
|  | ||||
|             "댓글" -> { | ||||
| @@ -499,6 +501,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | ||||
|                     .innerJoin(audioContentComment.audioContent.theme, audioContentTheme) | ||||
|                     .where( | ||||
|                         where | ||||
|                             .and(audioContentComment.isActive.isTrue) | ||||
|                             .and(audioContentComment.createdAt.goe(startDate)) | ||||
|                             .and(audioContentComment.createdAt.lt(endDate)) | ||||
|                     ) | ||||
| @@ -514,6 +517,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | ||||
|                     .innerJoin(audioContentLike.audioContent.theme, audioContentTheme) | ||||
|                     .where( | ||||
|                         where | ||||
|                             .and(audioContentLike.isActive.isTrue) | ||||
|                             .and(audioContentLike.createdAt.goe(startDate)) | ||||
|                             .and(audioContentLike.createdAt.lt(endDate)) | ||||
|                     ) | ||||
| @@ -529,6 +533,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | ||||
|                     .innerJoin(audioContent.theme, audioContentTheme) | ||||
|                     .where( | ||||
|                         where | ||||
|                             .and(order.isActive.isTrue) | ||||
|                             .and(order.createdAt.goe(startDate)) | ||||
|                             .and(order.createdAt.lt(endDate)) | ||||
|                     ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user