Changes in / [89438a3:93341f8]


Ignore:
Location:
src/main
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/model/Seat.java

    r89438a3 r93341f8  
    1919    @ManyToOne
    2020    @JoinColumn(name = "id_room")
    21     Projection_Room projection;
     21    Projection_Room projection_room;
    2222    @ManyToOne
    2323    @JoinColumn(name = "id_category")
  • src/main/java/com/example/moviezone/model/procedures/FilmsReturnTable.java

    r89438a3 r93341f8  
    1818        this.name = name;
    1919    }
    20 
    21     public Integer getId_film() {
    22         return id_film;
    23     }
    24 
    25     public LocalDate getStart_date() {
    26         return start_date;
    27     }
    28 
    29     public String getName() {
    30         return name;
    31     }
    3220}
  • src/main/java/com/example/moviezone/repository/FilmRepository.java

    r89438a3 r93341f8  
    77import org.springframework.data.repository.query.Param;
    88
    9 import javax.transaction.Transactional;
    109import java.util.List;
    11 @Transactional
     10
    1211public interface FilmRepository extends JpaRepository<Film,Integer> {
    1312    @Procedure("project.getFilmsFromCinema")
  • src/main/java/com/example/moviezone/repository/ProjectionIsPlayedInRoomRepository.java

    r89438a3 r93341f8  
    44import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoomId;
    55import org.springframework.data.jpa.repository.JpaRepository;
    6 import org.springframework.data.jpa.repository.Query;
    7 import org.springframework.data.repository.query.Param;
    86
    97import java.util.List;
    108
    119public interface ProjectionIsPlayedInRoomRepository extends JpaRepository<ProjectionIsPlayedInRoom, ProjectionIsPlayedInRoomId> {
    12     @Query("SELECT pir FROM ProjectionIsPlayedInRoom pir WHERE pir.id_projection = :id_projection")
    13     List<ProjectionIsPlayedInRoom> findAllByProjectionId(@Param("id_projection") Integer id_projection);
     10    List<ProjectionIsPlayedInRoom> findAllById_projection(Integer id_projection);
    1411}
  • src/main/java/com/example/moviezone/repository/SeatRepository.java

    r89438a3 r93341f8  
    1010@Repository
    1111public interface SeatRepository extends JpaRepository<Seat,Integer> {
    12     List<Seat> findAllByProjection(Projection_Room projection);
     12    List<Seat> findAllByProjection_room(Projection_Room projection_room);
    1313}
  • src/main/java/com/example/moviezone/service/FilmService.java

    r89438a3 r93341f8  
    22
    33import com.example.moviezone.model.Film;
    4 import com.example.moviezone.model.procedures.FilmsReturnTable;
    54
    65import java.time.LocalDate;
     
    1312              String age_category, String url, String director, LocalDate start_date,LocalDate end_date);
    1413    Optional<Film> getFilmById(Long id);
    15     List<FilmsReturnTable> getFilmsFromCinema(int id);
    1614}
  • src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java

    r89438a3 r93341f8  
    22
    33import com.example.moviezone.model.Film;
    4 import com.example.moviezone.model.procedures.FilmsReturnTable;
    54import com.example.moviezone.repository.FilmRepository;
    65import com.example.moviezone.service.FilmService;
     
    3534    }
    3635
    37     @Override
    38     public List<FilmsReturnTable> getFilmsFromCinema(int id) {
    39         return filmRepository.getFilmsFromCinema(id);
    40     }
    41 
    4236}
  • src/main/java/com/example/moviezone/service/Impl/ProjectionIsPlayedInRoomServiceImpl.java

    r89438a3 r93341f8  
    11package com.example.moviezone.service.Impl;
    22
    3 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
    43import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository;
    54import com.example.moviezone.service.ProjectionIsPlayedInRoomService;
    65import org.springframework.stereotype.Service;
    7 
    8 import java.util.List;
    9 import java.util.Optional;
    106
    117@Service
     
    1713    }
    1814
    19     @Override
    20     public List<ProjectionIsPlayedInRoom> getProjectionPlayedInRoom(Integer id) {
    21         return projectionIsPlayedInRoomRepository.findAllByProjectionId(id);
    22     }
    2315}
  • src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java

    r89438a3 r93341f8  
    2424    @Override
    2525    public List<Seat> findAllByProjection_Room(Projection_Room projection_room) {
    26         return seatRepository.findAllByProjection(projection_room);
     26        return seatRepository.findAllByProjection_room(projection_room);
    2727    }
    2828}
  • src/main/java/com/example/moviezone/service/ProjectionIsPlayedInRoomService.java

    r89438a3 r93341f8  
    11package com.example.moviezone.service;
    22
    3 import com.example.moviezone.model.Film;
    4 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
     3public interface ProjectionIsPlayedInRoomService {
    54
    6 import java.util.List;
    7 import java.util.Optional;
    8 
    9 public interface ProjectionIsPlayedInRoomService {
    10     List<ProjectionIsPlayedInRoom> getProjectionPlayedInRoom(Integer id);
    115
    126}
  • src/main/java/com/example/moviezone/web/HomeController.java

    r89438a3 r93341f8  
    44import com.example.moviezone.model.*;
    55import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException;
    6 
    76import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
    87import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository;
    9 
    10 import com.example.moviezone.model.procedures.FilmsReturnTable;
    11 
    128import com.example.moviezone.service.*;
    139import org.springframework.format.annotation.DateTimeFormat;
     
    1814import javax.servlet.http.HttpSession;
    1915import java.time.LocalDate;
    20 import java.util.LinkedList;
    2116import java.util.List;
    2217import java.util.stream.Collectors;
     
    3631private final CinemaOrganizesEventService cinemaOrganizesEventService;
    3732private final CinemaPlaysFilmService cinemaPlaysFilmService;
    38 private final ProjectionIsPlayedInRoomService projectionIsPlayedInRoomService;
    39 
    40 
    41     public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository)
    42     {
     33private final ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository;
     34
     35
     36    public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository) {
    4337
    4438        this.filmService = filmService;
     
    5246        this.cinemaOrganizesEventService = cinemaOrganizesEventService;
    5347        this.cinemaPlaysFilmService = cinemaPlaysFilmService;
    54         this.projectionIsPlayedInRoomService = projectionIsPlayedInRoomService;
     48        this.projectionIsPlayedInRoomRepository = projectionIsPlayedInRoomRepository;
    5549    }
    5650
     
    133127
    134128    }
     129
    135130    @GetMapping("/films")
    136131    public String getFilmsPage(Model model){
    137132        model.addAttribute("cinemas",cinemaService.findAllCinemas());
    138             List<FilmsReturnTable> pom=new LinkedList<>();
    139             model.addAttribute("films",pom);
    140             boolean h=pom.isEmpty();
    141             List<FilmsReturnTable> help=filmService.getFilmsFromCinema(2);
     133        model.addAttribute("films",filmService.findAllFilms());
    142134        model.addAttribute("bodyContent","films");
    143135        return "master-template";
    144136    }
    145137
    146     public String getFilmsPage1(Model model,Integer id_cinema){
    147         model.addAttribute("cinemas",cinemaService.findAllCinemas());
    148         if (id_cinema!=null) {
    149             model.addAttribute("films",filmService.getFilmsFromCinema(id_cinema.intValue()));
    150         }else{
    151             List<FilmsReturnTable> pom=new LinkedList<>();
    152             model.addAttribute("films",pom);
    153         }
    154 
    155         model.addAttribute("bodyContent","films");
    156         return "master-template";
    157     }
    158     @PostMapping("/getFilmsFromCinema")
    159     public String getFilmsFromCinema(@RequestParam Integer cinema, Model model){
    160         return getFilmsPage1(model,cinema);
    161     }
    162138    @GetMapping("/projections")
    163139    public String getProjectionsPage(Model model)
     
    286262
    287263
    288         List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomService.getProjectionPlayedInRoom(id_projection);
     264        List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomRepository.findAllById_projection(id_projection);
    289265
    290266        model.addAttribute("projection",projection);
  • src/main/resources/templates/films.html

    r89438a3 r93341f8  
    200200</style>
    201201<div>
    202     <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}"
    203           th:method="POST">
    204 
    205202    <div class="form-group">
    206203        <label style="color: white;font-size: 20px;font-weight: bold">Кино</label>
    207         <select name="cinemas" class="form-control" id="cinema">
     204        <select name="cinemas" class="form-control">
    208205            <option
    209206                    th:selected="${cinemas.get(1)}"
     
    213210            </option>
    214211        </select>
    215 
    216212    </div>
    217         <button class="button" type="submit">Filter</button>
    218 </form>
    219213
    220214</div>
    221215<div xmlns:th="http://www.thymeleaf.org">
    222216    <div class="main">
    223         <div    th:if="${films.isEmpty()} == false"
    224                 th:each="film : ${films}" class="container">
     217<!--        <div th:each="film : ${films}" class="container">-->
     218<!--            <div class="card">-->
     219<!--                <div class="imgBx">-->
     220<!--                    <img th:src="@{${film.getUrl()}}"/>-->
     221<!--                </div>-->
     222<!--                <div class="contentBx">-->
     223<!--                    <h2  th:text="${film.getName()}"></h2>-->
     224<!--                    <div class="size">-->
     225<!--                        <h3>Duration :</h3>-->
     226<!--                        <span th:text="${film.getDuration()}"></span>-->
     227<!--                    </div>-->
     228<!--                    <div class="color">-->
     229<!--                        <h3>Genre:</h3>-->
     230<!--                        <span th:text="${film.getGenre()}"></span>-->
     231<!--                    </div>-->
     232<!--                    <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}"-->
     233<!--                          th:method="GET">-->
     234<!--                        <button class="button" type="submit">Details</button>-->
     235<!--                    </form>-->
     236
     237
     238<!--                </div>-->
     239<!--            </div>-->
     240<!--        </div>-->
     241        <div th:each="film : ${films}" class="container">
    225242            <div class="card">
    226243                <div class="imgBx">
    227                     <img th:src=""/>
     244                    <img th:src="@{${film.getUrl()}}"/>
    228245                </div>
    229246                <div class="contentBx">
    230                     <h2  th:if="${films.isEmpty()} == false"
    231                             th:text="${film.getName()}"></h2>
     247                    <h2  th:text="${film.getName()}"></h2>
     248                    <div class="size">
     249                        <h3>Duration :</h3>
     250                        <span th:text="${film.getDuration()}"></span>
     251                    </div>
    232252                    <div class="color">
    233                         <h3>Start Date:</h3>
    234                         <span th:if="${films.isEmpty()} == false"
    235                                 th:text="${film.getStart_date()}"></span>
     253                        <h3>Genre:</h3>
     254                        <span th:text="${film.getGenre()}"></span>
    236255                    </div>
    237                     <form th:if="${films.isEmpty()} == false"
    238                             th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}"
     256                    <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}"
    239257                          th:method="GET">
    240258                        <button class="button" type="submit">Details</button>
Note: See TracChangeset for help on using the changeset viewer.