콘텐츠 메인 시리즈 탭 - 완결 시리즈

- 완결시리즈 전체 보여주기
- 정렬 - 월별 판매량 순
This commit is contained in:
Klaus 2025-02-19 02:20:10 +09:00
parent 000fb7c941
commit 7041aff350
3 changed files with 11 additions and 25 deletions

View File

@ -184,9 +184,7 @@ class AudioContentMainTabSeriesService(
val totalCount = rankingService.getCompleteSeriesRankingTotalCount(
memberId = memberId,
isAdult = isAdult,
startDate = monthlyRankingStartDate,
endDate = monthlyRankingEndDate
isAdult = isAdult
)
val items = rankingService.getCompleteSeriesRanking(

View File

@ -209,12 +209,7 @@ class RankingRepository(
.fetch()
}
fun getCompleteSeriesRankingTotalCount(
memberId: Long,
isAdult: Boolean,
startDate: LocalDateTime,
endDate: LocalDateTime
): Int {
fun getCompleteSeriesRankingTotalCount(memberId: Long, isAdult: Boolean): Int {
val blockMemberCondition = blockMember.member.id.eq(member.id)
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
@ -228,9 +223,6 @@ class RankingRepository(
.and(audioContent.duration.isNotNull)
.and(audioContent.limited.isNull)
.and(blockMember.id.isNull)
.and(order.isActive.isTrue)
.and(order.createdAt.goe(startDate))
.and(order.createdAt.lt(endDate))
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
@ -242,11 +234,9 @@ class RankingRepository(
.innerJoin(seriesContent.series, series)
.innerJoin(seriesContent.content, audioContent)
.innerJoin(series.member, member)
.leftJoin(order).on(audioContent.id.eq(order.audioContent.id))
.leftJoin(blockMember).on(blockMemberCondition)
.where(where)
.groupBy(series.id)
.orderBy(order.can.sum().desc())
.fetch()
.size
}
@ -263,6 +253,11 @@ class RankingRepository(
.and(blockMember.isActive.isTrue)
.and(blockMember.blockedMember.id.eq(memberId))
val orderCondition = order.isActive.isTrue
.and(audioContent.id.eq(order.audioContent.id))
.and(order.createdAt.goe(startDate))
.and(order.createdAt.lt(endDate))
var where = series.isActive.isTrue
.and(series.state.eq(SeriesState.COMPLETE))
.and(audioContent.isActive.isTrue)
@ -272,9 +267,6 @@ class RankingRepository(
.and(audioContent.duration.isNotNull)
.and(audioContent.limited.isNull)
.and(blockMember.id.isNull)
.and(order.isActive.isTrue)
.and(order.createdAt.goe(startDate))
.and(order.createdAt.lt(endDate))
if (!isAdult) {
where = where.and(series.isAdult.isFalse)
@ -286,11 +278,11 @@ class RankingRepository(
.innerJoin(seriesContent.series, series)
.innerJoin(seriesContent.content, audioContent)
.innerJoin(series.member, member)
.leftJoin(order).on(audioContent.id.eq(order.audioContent.id))
.leftJoin(order).on(orderCondition)
.leftJoin(blockMember).on(blockMemberCondition)
.where(where)
.groupBy(series.id)
.orderBy(order.can.sum().desc())
.orderBy(order.id.count().desc(), series.id.desc())
.offset(offset)
.limit(limit)
.fetch()

View File

@ -84,15 +84,11 @@ class RankingService(
fun getCompleteSeriesRankingTotalCount(
memberId: Long,
isAdult: Boolean,
startDate: LocalDateTime,
endDate: LocalDateTime
isAdult: Boolean
): Int {
return repository.getCompleteSeriesRankingTotalCount(
memberId = memberId,
isAdult = isAdult,
startDate = startDate,
endDate = endDate
isAdult = isAdult
)
}