@@ -1,5 +1,6 @@
|
|||||||
package kr.co.vividnext.sodalive.content.theme
|
package kr.co.vividnext.sodalive.content.theme
|
||||||
|
|
||||||
|
import com.querydsl.core.types.dsl.CaseBuilder
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||||
import kr.co.vividnext.sodalive.content.ContentType
|
import kr.co.vividnext.sodalive.content.ContentType
|
||||||
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
import kr.co.vividnext.sodalive.content.QAudioContent.audioContent
|
||||||
@@ -64,15 +65,27 @@ class AudioContentThemeQueryRepository(
|
|||||||
where = where.and(audioContent.isPointAvailable.isTrue)
|
where = where.and(audioContent.isPointAvailable.isTrue)
|
||||||
}
|
}
|
||||||
|
|
||||||
return queryFactory
|
val query = queryFactory
|
||||||
.select(audioContentTheme.theme)
|
.select(audioContentTheme.theme)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
.innerJoin(audioContent.member, member)
|
.innerJoin(audioContent.member, member)
|
||||||
.innerJoin(audioContent.theme, audioContentTheme)
|
.innerJoin(audioContent.theme, audioContentTheme)
|
||||||
.where(where)
|
.where(where)
|
||||||
.groupBy(audioContentTheme.id)
|
.groupBy(audioContentTheme.id)
|
||||||
.orderBy(audioContentTheme.orders.asc())
|
|
||||||
.fetch()
|
if (isFree) {
|
||||||
|
query.orderBy(
|
||||||
|
CaseBuilder()
|
||||||
|
.`when`(audioContentTheme.theme.eq("자기소개")).then(0)
|
||||||
|
.otherwise(1)
|
||||||
|
.asc(),
|
||||||
|
audioContentTheme.orders.asc()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
query.orderBy(audioContentTheme.orders.asc())
|
||||||
|
}
|
||||||
|
|
||||||
|
return query.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findThemeByIdAndActive(id: Long): AudioContentTheme? {
|
fun findThemeByIdAndActive(id: Long): AudioContentTheme? {
|
||||||
|
|||||||
Reference in New Issue
Block a user