콘텐츠 메인 - 새로운 콘텐츠 섹션 두번째 정렬 조건 추가
- 최신순은 id값 내림차순, 오래된 순은 id값 오름차순 추가
This commit is contained in:
parent
afc7bd68c1
commit
e0424b1678
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue