parent
00ce6d6a7a
commit
8285589b10
|
@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.PostMapping
|
|||
import org.springframework.web.bind.annotation.PutMapping
|
||||
import org.springframework.web.bind.annotation.RequestBody
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import org.springframework.web.multipart.MultipartFile
|
||||
|
@ -33,5 +34,7 @@ class AdminContentBannerController(private val service: AdminContentBannerServic
|
|||
) = ApiResponse.ok(service.updateBannerOrders(request.ids), "수정되었습니다.")
|
||||
|
||||
@GetMapping
|
||||
fun getAudioContentMainBannerList() = ApiResponse.ok(service.getAudioContentMainBannerList())
|
||||
fun getAudioContentMainBannerList(
|
||||
@RequestParam(value = "tabId", required = false) tabId: Long? = null
|
||||
) = ApiResponse.ok(service.getAudioContentMainBannerList(tabId = tabId))
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.admin.content.banner
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory
|
||||
import kr.co.vividnext.sodalive.content.main.banner.AudioContentBanner
|
||||
import kr.co.vividnext.sodalive.content.main.banner.QAudioContentBanner.audioContentBanner
|
||||
import kr.co.vividnext.sodalive.content.main.tab.QAudioContentMainTab.audioContentMainTab
|
||||
import kr.co.vividnext.sodalive.creator.admin.content.series.QSeries.series
|
||||
import kr.co.vividnext.sodalive.event.QEvent.event
|
||||
import kr.co.vividnext.sodalive.member.QMember.member
|
||||
|
@ -14,7 +15,7 @@ import org.springframework.stereotype.Repository
|
|||
interface AdminContentBannerRepository : JpaRepository<AudioContentBanner, Long>, AdminContentBannerQueryRepository
|
||||
|
||||
interface AdminContentBannerQueryRepository {
|
||||
fun getAudioContentMainBannerList(): List<GetAdminContentBannerResponse>
|
||||
fun getAudioContentMainBannerList(tabId: Long = 1): List<GetAdminContentBannerResponse>
|
||||
}
|
||||
|
||||
class AdminContentBannerQueryRepositoryImpl(
|
||||
|
@ -22,7 +23,15 @@ class AdminContentBannerQueryRepositoryImpl(
|
|||
@Value("\${cloud.aws.cloud-front.host}")
|
||||
private val cloudFrontHost: String
|
||||
) : AdminContentBannerQueryRepository {
|
||||
override fun getAudioContentMainBannerList(): List<GetAdminContentBannerResponse> {
|
||||
override fun getAudioContentMainBannerList(tabId: Long): List<GetAdminContentBannerResponse> {
|
||||
var where = audioContentBanner.isActive.isTrue
|
||||
|
||||
where = if (tabId <= 1L) {
|
||||
where.and(audioContentMainTab.id.isNull)
|
||||
} else {
|
||||
where.and(audioContentMainTab.id.eq(tabId))
|
||||
}
|
||||
|
||||
return queryFactory
|
||||
.select(
|
||||
QGetAdminContentBannerResponse(
|
||||
|
@ -43,7 +52,8 @@ class AdminContentBannerQueryRepositoryImpl(
|
|||
.leftJoin(audioContentBanner.event, event)
|
||||
.leftJoin(audioContentBanner.creator, member)
|
||||
.leftJoin(audioContentBanner.series, series)
|
||||
.where(audioContentBanner.isActive.isTrue)
|
||||
.leftJoin(audioContentBanner.tab, audioContentMainTab)
|
||||
.where(where)
|
||||
.orderBy(audioContentBanner.orders.asc())
|
||||
.fetch()
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ class AdminContentBannerService(
|
|||
}
|
||||
}
|
||||
|
||||
fun getAudioContentMainBannerList(): List<GetAdminContentBannerResponse> {
|
||||
return repository.getAudioContentMainBannerList()
|
||||
fun getAudioContentMainBannerList(tabId: Long?): List<GetAdminContentBannerResponse> {
|
||||
return repository.getAudioContentMainBannerList(tabId = tabId ?: 1)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerType
|
|||
|
||||
data class CreateContentBannerRequest(
|
||||
val type: AudioContentBannerType,
|
||||
val tabId: Long?,
|
||||
val eventId: Long?,
|
||||
val creatorId: Long?,
|
||||
val seriesId: Long?,
|
||||
|
|
|
@ -5,6 +5,7 @@ import kr.co.vividnext.sodalive.content.main.banner.AudioContentBannerType
|
|||
data class UpdateContentBannerRequest(
|
||||
val id: Long,
|
||||
val type: AudioContentBannerType?,
|
||||
val tabId: Long?,
|
||||
val eventId: Long?,
|
||||
val creatorId: Long?,
|
||||
val seriesId: Long?,
|
||||
|
|
Loading…
Reference in New Issue