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)
|
where = where.and(audioContent.isAdult.isFalse)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (categoryId > 0) {
|
var select = queryFactory
|
||||||
where = where.and(categoryContent.category.id.eq(categoryId))
|
|
||||||
}
|
|
||||||
|
|
||||||
return queryFactory
|
|
||||||
.select(
|
.select(
|
||||||
QGetAudioContentListItem(
|
QGetAudioContentListItem(
|
||||||
audioContent.id,
|
audioContent.id,
|
||||||
|
@ -187,21 +183,43 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
.leftJoin(categoryContent)
|
|
||||||
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
|
||||||
.leftJoin(pinContent)
|
.leftJoin(pinContent)
|
||||||
.on(audioContent.id.eq(pinContent.content.id).and(pinContent.isActive.ne(false)))
|
.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)
|
.offset(offset)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.orderBy(
|
|
||||||
pinContent.isActive.desc(),
|
select = if (categoryId > 0) {
|
||||||
pinContent.updatedAt.desc(),
|
select
|
||||||
orderBy,
|
.orderBy(
|
||||||
audioContent.updatedAt.desc(),
|
pinContent.isActive.desc(),
|
||||||
audioContent.id.desc()
|
pinContent.updatedAt.desc(),
|
||||||
)
|
orderBy,
|
||||||
.fetch()
|
categoryContent.updatedAt.desc(),
|
||||||
|
audioContent.id.desc()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
select
|
||||||
|
.orderBy(
|
||||||
|
pinContent.isActive.desc(),
|
||||||
|
pinContent.updatedAt.desc(),
|
||||||
|
orderBy,
|
||||||
|
audioContent.updatedAt.desc(),
|
||||||
|
audioContent.id.desc()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return select.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun findTotalCountByCreatorId(
|
override fun findTotalCountByCreatorId(
|
||||||
|
@ -219,18 +237,20 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||||
where = where.and(audioContent.isAdult.isFalse)
|
where = where.and(audioContent.isAdult.isFalse)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (categoryId > 0) {
|
var select = queryFactory
|
||||||
where = where.and(categoryContent.category.id.eq(categoryId))
|
|
||||||
}
|
|
||||||
|
|
||||||
return queryFactory
|
|
||||||
.select(audioContent.id)
|
.select(audioContent.id)
|
||||||
.from(audioContent)
|
.from(audioContent)
|
||||||
.leftJoin(categoryContent)
|
|
||||||
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
select = if (categoryId > 0) {
|
||||||
.where(where)
|
select
|
||||||
.fetch()
|
.leftJoin(categoryContent)
|
||||||
.size
|
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
|
||||||
|
.where(where.and(categoryContent.category.id.eq(categoryId)))
|
||||||
|
} else {
|
||||||
|
select.where(where)
|
||||||
|
}
|
||||||
|
|
||||||
|
return select.fetch().size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCreatorOtherContentList(
|
override fun getCreatorOtherContentList(
|
||||||
|
|
Loading…
Reference in New Issue