콘텐츠 고정

- 고정 콘텐츠 개수 표시 수정
This commit is contained in:
2024-01-27 02:43:41 +09:00
parent 95e31bb629
commit cec4cd0d28
2 changed files with 10 additions and 4 deletions

View File

@@ -7,16 +7,22 @@ import org.springframework.data.jpa.repository.JpaRepository
interface PinContentRepository : JpaRepository<PinContent, Long>, PinContentQueryRepository
interface PinContentQueryRepository {
fun getPinContentList(memberId: Long): List<PinContent>
fun getPinContentList(memberId: Long, active: Boolean? = null): List<PinContent>
fun findByContentIdAndMemberId(contentId: Long, memberId: Long, active: Boolean? = null): PinContent?
}
class PinContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : PinContentQueryRepository {
override fun getPinContentList(memberId: Long): List<PinContent> {
override fun getPinContentList(memberId: Long, active: Boolean?): List<PinContent> {
var where = pinContent.member.id.eq(memberId)
if (active != null) {
where = where.and(pinContent.isActive.eq(active))
}
return queryFactory
.selectFrom(pinContent)
.where(pinContent.member.id.eq(memberId))
.where(where)
.orderBy(pinContent.updatedAt.asc())
.fetch()
}