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) where = where.and(audioContent.isAdult.isFalse)
} }
var select = queryFactory if (categoryId > 0) {
where = where.and(categoryContent.category.id.eq(categoryId))
}
return queryFactory
.select( .select(
QGetAudioContentListItem( QGetAudioContentListItem(
audioContent.id, audioContent.id,
@ -183,43 +187,21 @@ 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(
select = if (categoryId > 0) { pinContent.isActive.desc(),
select pinContent.updatedAt.desc(),
.orderBy( orderBy,
pinContent.isActive.desc(), audioContent.updatedAt.desc(),
pinContent.updatedAt.desc(), audioContent.id.desc()
orderBy, )
categoryContent.updatedAt.desc(), .fetch()
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(
@ -237,20 +219,18 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
where = where.and(audioContent.isAdult.isFalse) where = where.and(audioContent.isAdult.isFalse)
} }
var select = queryFactory if (categoryId > 0) {
.select(audioContent.id) where = where.and(categoryContent.category.id.eq(categoryId))
.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)
} }
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( override fun getCreatorOtherContentList(