diff --git a/core/src/main/java/dev/hooon/show/infrastructure/adaptor/SeatRepositoryAdaptor.java b/core/src/main/java/dev/hooon/show/infrastructure/adaptor/SeatRepositoryAdaptor.java index e87e06f5..c32c8bb0 100644 --- a/core/src/main/java/dev/hooon/show/infrastructure/adaptor/SeatRepositoryAdaptor.java +++ b/core/src/main/java/dev/hooon/show/infrastructure/adaptor/SeatRepositoryAdaptor.java @@ -25,4 +25,4 @@ public void saveAll(Iterable seats) { public List findSeatDateRoundInfoByShowId(Long showId) { return seatJpaRepository.findSeatDateRoundInfoByShowId(showId); } -} +} \ No newline at end of file diff --git a/core/src/main/java/dev/hooon/show/infrastructure/repository/SeatJpaRepository.java b/core/src/main/java/dev/hooon/show/infrastructure/repository/SeatJpaRepository.java index c2931fc5..2d0b4932 100644 --- a/core/src/main/java/dev/hooon/show/infrastructure/repository/SeatJpaRepository.java +++ b/core/src/main/java/dev/hooon/show/infrastructure/repository/SeatJpaRepository.java @@ -1,13 +1,21 @@ -package dev.hooon.show.domain.repository; +package dev.hooon.show.infrastructure.repository; import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + import dev.hooon.show.domain.entity.seat.Seat; import dev.hooon.show.dto.query.SeatDateRoundDto; -public interface SeatRepository { - - void saveAll(Iterable seats); +public interface SeatJpaRepository extends JpaRepository { + @Query(""" + select distinct + new dev.hooon.show.dto.query.SeatDateRoundDto(s.showDate, s.showRound.round, s.showRound.startTime) + from Seat s + where s.show.id = :showId + order by s.showDate, s.showRound.round + """) List findSeatDateRoundInfoByShowId(Long showId); } \ No newline at end of file