- 결과값에 시그니처 이미지 URL 데이터 추가
This commit is contained in:
2024-03-07 19:38:25 +09:00
parent 0d402b608c
commit 71937ce89c
5 changed files with 42 additions and 7 deletions

View File

@@ -0,0 +1,25 @@
package kr.co.vividnext.sodalive.live.signature
import com.querydsl.jpa.impl.JPAQueryFactory
import kr.co.vividnext.sodalive.live.signature.QSignatureCan.signatureCan
import org.springframework.data.jpa.repository.JpaRepository
interface SignatureCanRepository : JpaRepository<SignatureCan, Long>, SignatureCanQueryRepository
interface SignatureCanQueryRepository {
fun findImageByCreatorIdAndCan(creatorId: Long, can: Int, imageHost: String): String?
}
class SignatureCanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : SignatureCanQueryRepository {
override fun findImageByCreatorIdAndCan(creatorId: Long, can: Int, imageHost: String): String? {
return queryFactory
.select(signatureCan.image.prepend("/").prepend(imageHost))
.from(signatureCan)
.where(
signatureCan.creator.id.eq(creatorId)
.and(signatureCan.can.eq(can))
.and(signatureCan.isActive.isTrue)
)
.fetchFirst()
}
}