diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/admin/marketing/statistics/AdminAdStatisticsRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/admin/marketing/statistics/AdminAdStatisticsRepository.kt index cd7f46c..c1b4b1b 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/admin/marketing/statistics/AdminAdStatisticsRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/admin/marketing/statistics/AdminAdStatisticsRepository.kt @@ -14,18 +14,17 @@ import java.time.LocalDateTime @Repository class AdminAdStatisticsRepository(private val queryFactory: JPAQueryFactory) { fun getAdStatisticsDataTotalCount(): Int { - return ( - queryFactory - .select(adTrackingHistory.id.pid.count()) - .from(adTrackingHistory) - .groupBy( - getFormattedDate(adTrackingHistory.id.createdAt), - adTrackingHistory.mediaGroup, - adTrackingHistory.id.pid, - adTrackingHistory.pidName - ) - .fetchOne() ?: 0L - ).toInt() + return queryFactory + .select(adTrackingHistory.id.pid) + .from(adTrackingHistory) + .groupBy( + getFormattedDate(adTrackingHistory.id.createdAt), + adTrackingHistory.mediaGroup, + adTrackingHistory.id.pid, + adTrackingHistory.pidName + ) + .fetch() + .size } fun getAdStatisticsDataList( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt index f3ede60..46a2a22 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -410,8 +410,10 @@ class AudioContentQueryRepositoryImpl( where = where.and(audioContentTheme.theme.`in`(theme)) } - if (isFree) { - where = where.and(audioContent.price.loe(0)) + where = if (isFree) { + where.and(audioContent.price.loe(0)) + } else { + where.and(audioContent.price.gt(0)) } return queryFactory diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/theme/AudioContentThemeQueryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/theme/AudioContentThemeQueryRepository.kt index f518e36..c95f4c4 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/theme/AudioContentThemeQueryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/theme/AudioContentThemeQueryRepository.kt @@ -35,8 +35,10 @@ class AudioContentThemeQueryRepository( where = where.and(audioContent.isAdult.isFalse) } - if (isFree) { - where = where.and(audioContent.price.loe(0)) + where = if (isFree) { + where.and(audioContent.price.loe(0)) + } else { + where.and(audioContent.price.gt(0)) } return queryFactory