Merge pull request '카테고리 콘텐츠' (#126) from test into main
Reviewed-on: #126
This commit is contained in:
commit
59da1d6e49
|
@ -166,11 +166,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
where = where.and(audioContent.isAdult.isFalse)
|
||||
}
|
||||
|
||||
if (categoryId > 0) {
|
||||
where = where.and(categoryContent.category.id.eq(categoryId))
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
var select = queryFactory
|
||||
.select(
|
||||
QGetAudioContentListItem(
|
||||
audioContent.id,
|
||||
|
@ -187,13 +183,33 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
)
|
||||
)
|
||||
.from(audioContent)
|
||||
.leftJoin(categoryContent)
|
||||
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
||||
.leftJoin(pinContent)
|
||||
.on(audioContent.id.eq(pinContent.content.id).and(pinContent.isActive.ne(false)))
|
||||
.where(where)
|
||||
|
||||
select = if (categoryId > 0) {
|
||||
select
|
||||
.leftJoin(categoryContent)
|
||||
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
||||
.where(where.and(categoryContent.category.id.eq(categoryId)))
|
||||
} else {
|
||||
select.where(where)
|
||||
}
|
||||
|
||||
select = select
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
|
||||
select = if (categoryId > 0) {
|
||||
select
|
||||
.orderBy(
|
||||
pinContent.isActive.desc(),
|
||||
pinContent.updatedAt.desc(),
|
||||
orderBy,
|
||||
categoryContent.updatedAt.desc(),
|
||||
audioContent.id.desc()
|
||||
)
|
||||
} else {
|
||||
select
|
||||
.orderBy(
|
||||
pinContent.isActive.desc(),
|
||||
pinContent.updatedAt.desc(),
|
||||
|
@ -201,7 +217,9 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
audioContent.updatedAt.desc(),
|
||||
audioContent.id.desc()
|
||||
)
|
||||
.fetch()
|
||||
}
|
||||
|
||||
return select.fetch()
|
||||
}
|
||||
|
||||
override fun findTotalCountByCreatorId(
|
||||
|
@ -219,18 +237,20 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
|||
where = where.and(audioContent.isAdult.isFalse)
|
||||
}
|
||||
|
||||
if (categoryId > 0) {
|
||||
where = where.and(categoryContent.category.id.eq(categoryId))
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
var select = queryFactory
|
||||
.select(audioContent.id)
|
||||
.from(audioContent)
|
||||
|
||||
select = if (categoryId > 0) {
|
||||
select
|
||||
.leftJoin(categoryContent)
|
||||
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
||||
.where(where)
|
||||
.fetch()
|
||||
.size
|
||||
.where(where.and(categoryContent.category.id.eq(categoryId)))
|
||||
} else {
|
||||
select.where(where)
|
||||
}
|
||||
|
||||
return select.fetch().size
|
||||
}
|
||||
|
||||
override fun getCreatorOtherContentList(
|
||||
|
|
Loading…
Reference in New Issue