[fc7ec52] | 1 | package com.example.demo.repository;
|
---|
| 2 |
|
---|
| 3 | import com.example.demo.model.PaymentType;
|
---|
| 4 | import com.example.demo.model.Seat.Seat;
|
---|
| 5 | import com.example.demo.model.Seat.SeatCompositeKey;
|
---|
| 6 | import org.springframework.data.jpa.repository.JpaRepository;
|
---|
| 7 | import org.springframework.data.jpa.repository.Query;
|
---|
| 8 |
|
---|
| 9 | import java.util.Collection;
|
---|
| 10 | import java.util.List;
|
---|
| 11 | import java.util.Optional;
|
---|
| 12 |
|
---|
| 13 | public interface SeatRepository extends JpaRepository<Seat, SeatCompositeKey> {
|
---|
| 14 |
|
---|
| 15 | @Query(value="select * from Seat ", nativeQuery = true)
|
---|
| 16 | public Optional<Seat> findAllSeats();
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | @Query(value="select * from seat as s \n" +
|
---|
| 20 | " join gives as g on g.auditorium_id = s.auditorium_id\n" +
|
---|
| 21 | " join reservation as r on r.seat_id = s.seat_id and \n" +
|
---|
| 22 | " r.auditorium_id = s.auditorium_id \n" +
|
---|
| 23 | " join movieprojection as m on m.projection_id = r.projection_id\n" +
|
---|
| 24 | " where g.projection_id=?",nativeQuery = true)
|
---|
| 25 | public List<Seat> SelectionByProjection(Integer projection_id);
|
---|
| 26 |
|
---|
| 27 | @Query(value="select * from seat as s\n" +
|
---|
| 28 | " join gives as g on g.auditorium_id = s.auditorium_id\n" +
|
---|
| 29 | " join auditorium as a on a.auditorium_id = g.auditorium_id\n" +
|
---|
| 30 | " join movieprojection as m on m.projection_id = g.projection_id\n" +
|
---|
| 31 | " where m.projection_id=?",nativeQuery = true)
|
---|
| 32 | public List<Seat> selectFreeSeatsByProjection(Integer projection_id);
|
---|
| 33 |
|
---|
| 34 | @Query(value="select * from seat where auditorium_id=?",nativeQuery = true)
|
---|
| 35 | public Optional<Seat> selectById(Integer auditorium_id);
|
---|
| 36 |
|
---|
| 37 | @Query(value="select * from seat where seat_id=? and auditorium_id=?",nativeQuery = true)
|
---|
| 38 | public Optional<Seat> findSeatAuditorium(Integer seat_id,Integer auditorium_id);
|
---|
| 39 |
|
---|
| 40 | } |
---|