source: source/MovieZilla-master/src/main/java/com/example/demo/repository/SeatRepository.java@ fc7ec52

Last change on this file since fc7ec52 was fc7ec52, checked in by darkopopovski <darkopopovski39@…>, 22 months ago

all files

  • Property mode set to 100644
File size: 1.7 KB
Line 
1package com.example.demo.repository;
2
3import com.example.demo.model.PaymentType;
4import com.example.demo.model.Seat.Seat;
5import com.example.demo.model.Seat.SeatCompositeKey;
6import org.springframework.data.jpa.repository.JpaRepository;
7import org.springframework.data.jpa.repository.Query;
8
9import java.util.Collection;
10import java.util.List;
11import java.util.Optional;
12
13public 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}
Note: See TracBrowser for help on using the repository browser.