Compare commits

..

No commits in common. "59da1d6e49f32d414dd83bea096c3434e360197f" and "5aef7dac3336f25e72113ab7a7d3cd7ccb303cb5" have entirely different histories.

1 changed files with 26 additions and 46 deletions

View File

@ -166,7 +166,11 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
where = where.and(audioContent.isAdult.isFalse)
}
var select = queryFactory
if (categoryId > 0) {
where = where.and(categoryContent.category.id.eq(categoryId))
}
return queryFactory
.select(
QGetAudioContentListItem(
audioContent.id,
@ -183,33 +187,13 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
)
)
.from(audioContent)
.leftJoin(pinContent)
.on(audioContent.id.eq(pinContent.content.id).and(pinContent.isActive.ne(false)))
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
.leftJoin(pinContent)
.on(audioContent.id.eq(pinContent.content.id).and(pinContent.isActive.ne(false)))
.where(where)
.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(),
@ -217,9 +201,7 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
audioContent.updatedAt.desc(),
audioContent.id.desc()
)
}
return select.fetch()
.fetch()
}
override fun findTotalCountByCreatorId(
@ -237,20 +219,18 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
where = where.and(audioContent.isAdult.isFalse)
}
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.and(categoryContent.category.id.eq(categoryId)))
} else {
select.where(where)
if (categoryId > 0) {
where = where.and(categoryContent.category.id.eq(categoryId))
}
return select.fetch().size
return queryFactory
.select(audioContent.id)
.from(audioContent)
.leftJoin(categoryContent)
.on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false)))
.where(where)
.fetch()
.size
}
override fun getCreatorOtherContentList(