카테고리 콘텐츠 #126

Merged
klaus merged 1 commits from test into main 2024-02-07 13:33:38 +00:00
1 changed files with 46 additions and 26 deletions

View File

@ -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,21 +183,43 @@ 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)
.orderBy(
pinContent.isActive.desc(),
pinContent.updatedAt.desc(),
orderBy,
audioContent.updatedAt.desc(),
audioContent.id.desc()
)
.fetch()
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(),
orderBy,
audioContent.updatedAt.desc(),
audioContent.id.desc()
)
}
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)
.leftJoin(categoryContent)
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
.where(where)
.fetch()
.size
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)
}
return select.fetch().size
}
override fun getCreatorOtherContentList(