From b822cf47bbc9e3afe36b4833b83e76398dd5c571 Mon Sep 17 00:00:00 2001
From: Klaus <klaus@vividnext.co.kr>
Date: Thu, 13 Mar 2025 19:51:58 +0900
Subject: [PATCH 1/2] =?UTF-8?q?=EA=B4=91=EA=B3=A0=20=ED=86=B5=EA=B3=84=20-?=
 =?UTF-8?q?=20=EC=A0=84=EC=B2=B4=20=EA=B0=9C=EC=88=98=20=EA=B3=84=EC=82=B0?=
 =?UTF-8?q?=EC=8B=9C=20NonUniqueResultException=20=EB=B2=84=EA=B7=B8=20?=
 =?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../statistics/AdminAdStatisticsRepository.kt | 23 +++++++++----------
 1 file changed, 11 insertions(+), 12 deletions(-)

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(

From 327b0149d9182479f5d979e9af7fb2d79323c560 Mon Sep 17 00:00:00 2001
From: Klaus <klaus@vividnext.co.kr>
Date: Thu, 13 Mar 2025 21:16:42 +0900
Subject: [PATCH 2/2] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=ED=99=88=20?=
 =?UTF-8?q?=EB=8B=A8=ED=8E=B8=20=ED=83=AD=20-=20=EC=9C=A0=EB=A3=8C=20?=
 =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=EB=A7=8C=20=EB=82=98=EC=98=A4?=
 =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../co/vividnext/sodalive/content/AudioContentRepository.kt | 6 ++++--
 .../content/theme/AudioContentThemeQueryRepository.kt       | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

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