From e0424b1678755317304a94f34812e8c96ea25278 Mon Sep 17 00:00:00 2001 From: Klaus Date: Fri, 4 Oct 2024 16:15:14 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20-=20=EC=83=88=EB=A1=9C=EC=9A=B4=20=EC=BD=98?= =?UTF-8?q?=ED=85=90=EC=B8=A0=20=EC=84=B9=EC=85=98=20=EB=91=90=EB=B2=88?= =?UTF-8?q?=EC=A7=B8=20=EC=A0=95=EB=A0=AC=20=EC=A1=B0=EA=B1=B4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20-=20=EC=B5=9C=EC=8B=A0=EC=88=9C=EC=9D=80=20id?= =?UTF-8?q?=EA=B0=92=20=EB=82=B4=EB=A6=BC=EC=B0=A8=EC=88=9C,=20=EC=98=A4?= =?UTF-8?q?=EB=9E=98=EB=90=9C=20=EC=88=9C=EC=9D=80=20id=EA=B0=92=20?= =?UTF-8?q?=EC=98=A4=EB=A6=84=EC=B0=A8=EC=88=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/AudioContentRepository.kt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 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 204d9d9..e086e62 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -337,9 +337,18 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) limit: Long ): List { val orderBy = when (sortType) { - SortType.NEWEST -> audioContent.releaseDate.desc() - SortType.PRICE_HIGH -> audioContent.price.desc() - SortType.PRICE_LOW -> audioContent.price.asc() + SortType.NEWEST -> listOf(audioContent.releaseDate.desc(), audioContent.id.desc()) + SortType.PRICE_HIGH -> listOf( + audioContent.price.desc(), + audioContent.releaseDate.desc(), + audioContent.id.desc() + ) + + SortType.PRICE_LOW -> listOf( + audioContent.price.asc(), + audioContent.releaseDate.asc(), + audioContent.id.asc() + ) } var where = audioContent.isActive.isTrue @@ -377,7 +386,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) .where(where) .offset(offset) .limit(limit) - .orderBy(orderBy) + .orderBy(*orderBy.toTypedArray()) .fetch() } @@ -480,7 +489,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) .where(where) .offset(offset) .limit(limit) - .orderBy(audioContent.releaseDate.desc()) + .orderBy(audioContent.releaseDate.desc(), audioContent.id.desc()) .fetch() }