콘텐츠 메인 - 새로운 콘텐츠 섹션 두번째 정렬 조건 추가 #220
| @@ -337,9 +337,18 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) | ||||
|         limit: Long | ||||
|     ): List<GetAudioContentMainItem> { | ||||
|         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() | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user