콘텐츠 메인 - 순위 정렬(매출, 후원, 댓글, 좋아요) 추가
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
package kr.co.vividnext.sodalive.content.like
|
||||
|
||||
import kr.co.vividnext.sodalive.content.AudioContent
|
||||
import java.time.LocalDateTime
|
||||
import javax.persistence.Entity
|
||||
import javax.persistence.FetchType
|
||||
import javax.persistence.GeneratedValue
|
||||
import javax.persistence.GenerationType
|
||||
import javax.persistence.Id
|
||||
import javax.persistence.JoinColumn
|
||||
import javax.persistence.ManyToOne
|
||||
import javax.persistence.PrePersist
|
||||
import javax.persistence.PreUpdate
|
||||
import javax.persistence.Table
|
||||
|
||||
@Entity
|
||||
@Table(name = "content_like")
|
||||
data class AudioContentLike(
|
||||
val memberId: Long,
|
||||
val contentId: Long
|
||||
) {
|
||||
data class AudioContentLike(val memberId: Long) {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var id: Long? = null
|
||||
@@ -34,4 +35,8 @@ data class AudioContentLike(
|
||||
}
|
||||
|
||||
var isActive = true
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "content_id", nullable = false)
|
||||
var audioContent: AudioContent? = null
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ class AudioContentLikeQueryRepositoryImpl(private val queryFactory: JPAQueryFact
|
||||
.selectFrom(audioContentLike)
|
||||
.where(
|
||||
audioContentLike.memberId.eq(memberId)
|
||||
.and(audioContentLike.contentId.eq(contentId))
|
||||
.and(audioContentLike.audioContent.id.eq(contentId))
|
||||
)
|
||||
.fetchFirst()
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class AudioContentLikeQueryRepositoryImpl(private val queryFactory: JPAQueryFact
|
||||
.select(audioContentLike.id)
|
||||
.from(audioContentLike)
|
||||
.where(
|
||||
audioContentLike.contentId.eq(contentId)
|
||||
audioContentLike.audioContent.id.eq(contentId)
|
||||
.and(audioContentLike.isActive.isTrue)
|
||||
)
|
||||
.fetch()
|
||||
|
Reference in New Issue
Block a user