generated from pricelees/issue-pr-template
[#44] 매장 기능 도입 #45
@ -2,23 +2,40 @@ package roomescape.schedule.infrastructure.persistence
|
|||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
import org.springframework.data.jpa.repository.Query
|
import org.springframework.data.jpa.repository.Query
|
||||||
|
import roomescape.schedule.business.domain.ScheduleWithThemeSummary
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
import java.time.LocalTime
|
import java.time.LocalTime
|
||||||
|
|
||||||
interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
||||||
|
|
||||||
fun findAllByDate(date: LocalDate): List<ScheduleEntity>
|
|
||||||
|
|
||||||
fun findAllByDateAndThemeId(date: LocalDate, themeId: Long): List<ScheduleEntity>
|
|
||||||
|
|
||||||
fun existsByDateAndThemeIdAndTime(date: LocalDate, themeId: Long, time: LocalTime): Boolean
|
fun existsByDateAndThemeIdAndTime(date: LocalDate, themeId: Long, time: LocalTime): Boolean
|
||||||
|
|
||||||
@Query(
|
@Query(
|
||||||
"""
|
"""
|
||||||
SELECT DISTINCT s.themeId
|
SELECT
|
||||||
FROM ScheduleEntity s
|
new roomescape.schedule.business.domain.ScheduleWithThemeSummary(
|
||||||
WHERE s.date = :date
|
s._id,
|
||||||
"""
|
s.date,
|
||||||
|
s.time,
|
||||||
|
t._id,
|
||||||
|
t.name,
|
||||||
|
t.difficulty,
|
||||||
|
t.availableMinutes,
|
||||||
|
s.status
|
||||||
|
)
|
||||||
|
FROM
|
||||||
|
ScheduleEntity s
|
||||||
|
JOIN
|
||||||
|
ThemeEntity t ON t._id = s.themeId
|
||||||
|
WHERE
|
||||||
|
s.storeId = :storeId
|
||||||
|
AND s.date = :date
|
||||||
|
AND (:themeId IS NULL OR s.themeId = :themeId)
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
fun findAllUniqueThemeIdByDate(date: LocalDate): List<Long>
|
fun findStoreSchedulesWithThemeByDate(
|
||||||
|
storeId: Long,
|
||||||
|
date: LocalDate,
|
||||||
|
themeId: Long? = null
|
||||||
|
): List<ScheduleWithThemeSummary>
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user