[fc7ec52] | 1 | package com.example.demo.repository;
|
---|
| 2 |
|
---|
| 3 | import com.example.demo.model.Movie;
|
---|
| 4 | import com.example.demo.model.MovieProjection;
|
---|
| 5 | import com.example.demo.model.PaymentType;
|
---|
| 6 | import org.springframework.data.jpa.repository.JpaRepository;
|
---|
| 7 | import org.springframework.data.jpa.repository.Query;
|
---|
| 8 |
|
---|
| 9 | import java.util.List;
|
---|
| 10 | import java.util.Optional;
|
---|
| 11 | import java.util.Set;
|
---|
| 12 |
|
---|
| 13 | public interface MovieProjectionRepository extends JpaRepository<MovieProjection, Integer> {
|
---|
| 14 | //Optional<MovieProjection> findbyName(String name);
|
---|
| 15 |
|
---|
| 16 | @Query(value = "select * from MovieProjection as mp join Movie as m on m.movie_id=mp.movie_id",nativeQuery = true)
|
---|
| 17 | List<MovieProjection> findJoined();
|
---|
| 18 |
|
---|
| 19 | @Query(value = "select * from MovieProjection where movie_id=?", nativeQuery = true)
|
---|
| 20 | List<MovieProjection> findByMovieID(Integer movie_id);
|
---|
| 21 |
|
---|
| 22 | @Query(value="select m.movie_name,g.genre_name,mp.projection_screening_date,m.movie_cast\n" +
|
---|
| 23 | "from movieprojection as mp\n" +
|
---|
| 24 | "join movie as m on m.movie_id = mp.movie_id\n" +
|
---|
| 25 | "join is_ as i on i.movie_id = m.movie_id\n" +
|
---|
| 26 | "join genre as g on g.genre_id = i.genre_id\n",nativeQuery = true)
|
---|
| 27 | public Set<MovieProjection> findSelected();
|
---|
| 28 |
|
---|
| 29 | @Query(value="select * from movieprojection where projection_id=?", nativeQuery = true)
|
---|
| 30 | public List<MovieProjection> findAllProjections(Integer projection_id);
|
---|
| 31 |
|
---|
| 32 | @Query(value="select * from movieprojection where projection_id=?", nativeQuery = true)
|
---|
| 33 | public List<MovieProjection> findProjectionsById(Integer projection_id);
|
---|
| 34 |
|
---|
| 35 | } |
---|