시그니처 후원
- 재생 시간 추가
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package kr.co.vividnext.sodalive.live.signature
|
||||
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import kr.co.vividnext.sodalive.live.room.donation.LiveRoomDonationResponse
|
||||
import kr.co.vividnext.sodalive.live.room.donation.QLiveRoomDonationResponse
|
||||
import kr.co.vividnext.sodalive.live.signature.QSignatureCan.signatureCan
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
|
||||
@@ -8,6 +10,7 @@ interface SignatureCanRepository : JpaRepository<SignatureCan, Long>, SignatureC
|
||||
|
||||
interface SignatureCanQueryRepository {
|
||||
fun findImageByCreatorIdAndCan(creatorId: Long, can: Int, imageHost: String, isAdult: Boolean): String?
|
||||
fun findByCreatorIdAndCan(creatorId: Long, can: Int, imageHost: String, isAdult: Boolean): LiveRoomDonationResponse?
|
||||
}
|
||||
|
||||
class SignatureCanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : SignatureCanQueryRepository {
|
||||
@@ -27,4 +30,31 @@ class SignatureCanQueryRepositoryImpl(private val queryFactory: JPAQueryFactory)
|
||||
.orderBy(signatureCan.isAdult.desc())
|
||||
.fetchFirst()
|
||||
}
|
||||
|
||||
override fun findByCreatorIdAndCan(
|
||||
creatorId: Long,
|
||||
can: Int,
|
||||
imageHost: String,
|
||||
isAdult: Boolean
|
||||
): LiveRoomDonationResponse? {
|
||||
var where = signatureCan.creator.id.eq(creatorId)
|
||||
.and(signatureCan.can.eq(can))
|
||||
.and(signatureCan.isActive.isTrue)
|
||||
|
||||
if (!isAdult) {
|
||||
where = where.and(signatureCan.isAdult.isFalse())
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
QLiveRoomDonationResponse(
|
||||
signatureCan.image.prepend("/").prepend(imageHost),
|
||||
signatureCan.time
|
||||
)
|
||||
)
|
||||
.from(signatureCan)
|
||||
.where(where)
|
||||
.orderBy(signatureCan.isAdult.desc())
|
||||
.fetchFirst()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user