- Timestamp:
- 02/08/23 11:18:57 (22 months ago)
- Branches:
- master
- Children:
- afa6544
- Parents:
- 93341f8 (diff), 64ee7f4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/main
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/model/Seat.java
r93341f8 r89438a3 19 19 @ManyToOne 20 20 @JoinColumn(name = "id_room") 21 Projection_Room projection _room;21 Projection_Room projection; 22 22 @ManyToOne 23 23 @JoinColumn(name = "id_category") -
src/main/java/com/example/moviezone/model/procedures/FilmsReturnTable.java
r93341f8 r89438a3 18 18 this.name = name; 19 19 } 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 } 20 32 } -
src/main/java/com/example/moviezone/repository/FilmRepository.java
r93341f8 r89438a3 7 7 import org.springframework.data.repository.query.Param; 8 8 9 import javax.transaction.Transactional; 9 10 import java.util.List; 10 11 @Transactional 11 12 public interface FilmRepository extends JpaRepository<Film,Integer> { 12 13 @Procedure("project.getFilmsFromCinema") -
src/main/java/com/example/moviezone/repository/ProjectionIsPlayedInRoomRepository.java
r93341f8 r89438a3 4 4 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoomId; 5 5 import org.springframework.data.jpa.repository.JpaRepository; 6 import org.springframework.data.jpa.repository.Query; 7 import org.springframework.data.repository.query.Param; 6 8 7 9 import java.util.List; 8 10 9 11 public interface ProjectionIsPlayedInRoomRepository extends JpaRepository<ProjectionIsPlayedInRoom, ProjectionIsPlayedInRoomId> { 10 List<ProjectionIsPlayedInRoom> findAllById_projection(Integer id_projection); 12 @Query("SELECT pir FROM ProjectionIsPlayedInRoom pir WHERE pir.id_projection = :id_projection") 13 List<ProjectionIsPlayedInRoom> findAllByProjectionId(@Param("id_projection") Integer id_projection); 11 14 } -
src/main/java/com/example/moviezone/repository/SeatRepository.java
r93341f8 r89438a3 10 10 @Repository 11 11 public interface SeatRepository extends JpaRepository<Seat,Integer> { 12 List<Seat> findAllByProjection _room(Projection_Room projection_room);12 List<Seat> findAllByProjection(Projection_Room projection); 13 13 } -
src/main/java/com/example/moviezone/service/FilmService.java
r93341f8 r89438a3 2 2 3 3 import com.example.moviezone.model.Film; 4 import com.example.moviezone.model.procedures.FilmsReturnTable; 4 5 5 6 import java.time.LocalDate; … … 12 13 String age_category, String url, String director, LocalDate start_date,LocalDate end_date); 13 14 Optional<Film> getFilmById(Long id); 15 List<FilmsReturnTable> getFilmsFromCinema(int id); 14 16 } -
src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java
r93341f8 r89438a3 2 2 3 3 import com.example.moviezone.model.Film; 4 import com.example.moviezone.model.procedures.FilmsReturnTable; 4 5 import com.example.moviezone.repository.FilmRepository; 5 6 import com.example.moviezone.service.FilmService; … … 34 35 } 35 36 37 @Override 38 public List<FilmsReturnTable> getFilmsFromCinema(int id) { 39 return filmRepository.getFilmsFromCinema(id); 40 } 41 36 42 } -
src/main/java/com/example/moviezone/service/Impl/ProjectionIsPlayedInRoomServiceImpl.java
r93341f8 r89438a3 1 1 package com.example.moviezone.service.Impl; 2 2 3 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom; 3 4 import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository; 4 5 import com.example.moviezone.service.ProjectionIsPlayedInRoomService; 5 6 import org.springframework.stereotype.Service; 7 8 import java.util.List; 9 import java.util.Optional; 6 10 7 11 @Service … … 13 17 } 14 18 19 @Override 20 public List<ProjectionIsPlayedInRoom> getProjectionPlayedInRoom(Integer id) { 21 return projectionIsPlayedInRoomRepository.findAllByProjectionId(id); 22 } 15 23 } -
src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java
r93341f8 r89438a3 24 24 @Override 25 25 public List<Seat> findAllByProjection_Room(Projection_Room projection_room) { 26 return seatRepository.findAllByProjection _room(projection_room);26 return seatRepository.findAllByProjection(projection_room); 27 27 } 28 28 } -
src/main/java/com/example/moviezone/service/ProjectionIsPlayedInRoomService.java
r93341f8 r89438a3 1 1 package com.example.moviezone.service; 2 2 3 import com.example.moviezone.model.Film; 4 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom; 5 6 import java.util.List; 7 import java.util.Optional; 8 3 9 public interface ProjectionIsPlayedInRoomService { 4 10 List<ProjectionIsPlayedInRoom> getProjectionPlayedInRoom(Integer id); 5 11 6 12 } -
src/main/java/com/example/moviezone/web/HomeController.java
r93341f8 r89438a3 4 4 import com.example.moviezone.model.*; 5 5 import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException; 6 6 7 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom; 7 8 import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository; 9 10 import com.example.moviezone.model.procedures.FilmsReturnTable; 11 8 12 import com.example.moviezone.service.*; 9 13 import org.springframework.format.annotation.DateTimeFormat; … … 14 18 import javax.servlet.http.HttpSession; 15 19 import java.time.LocalDate; 20 import java.util.LinkedList; 16 21 import java.util.List; 17 22 import java.util.stream.Collectors; … … 31 36 private final CinemaOrganizesEventService cinemaOrganizesEventService; 32 37 private final CinemaPlaysFilmService cinemaPlaysFilmService; 33 private 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) { 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 { 37 43 38 44 this.filmService = filmService; … … 46 52 this.cinemaOrganizesEventService = cinemaOrganizesEventService; 47 53 this.cinemaPlaysFilmService = cinemaPlaysFilmService; 48 this.projectionIsPlayedInRoom Repository = projectionIsPlayedInRoomRepository;54 this.projectionIsPlayedInRoomService = projectionIsPlayedInRoomService; 49 55 } 50 56 … … 127 133 128 134 } 129 130 135 @GetMapping("/films") 131 136 public String getFilmsPage(Model model){ 132 137 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 133 model.addAttribute("films",filmService.findAllFilms()); 138 List<FilmsReturnTable> pom=new LinkedList<>(); 139 model.addAttribute("films",pom); 140 boolean h=pom.isEmpty(); 141 List<FilmsReturnTable> help=filmService.getFilmsFromCinema(2); 134 142 model.addAttribute("bodyContent","films"); 135 143 return "master-template"; 136 144 } 137 145 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 } 138 162 @GetMapping("/projections") 139 163 public String getProjectionsPage(Model model) … … 262 286 263 287 264 List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoom Repository.findAllById_projection(id_projection);288 List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomService.getProjectionPlayedInRoom(id_projection); 265 289 266 290 model.addAttribute("projection",projection); -
src/main/resources/templates/films.html
r93341f8 r89438a3 200 200 </style> 201 201 <div> 202 <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}" 203 th:method="POST"> 204 202 205 <div class="form-group"> 203 206 <label style="color: white;font-size: 20px;font-weight: bold">Кино</label> 204 <select name="cinemas" class="form-control" >207 <select name="cinemas" class="form-control" id="cinema"> 205 208 <option 206 209 th:selected="${cinemas.get(1)}" … … 210 213 </option> 211 214 </select> 215 212 216 </div> 217 <button class="button" type="submit">Filter</button> 218 </form> 213 219 214 220 </div> 215 221 <div xmlns:th="http://www.thymeleaf.org"> 216 222 <div class="main"> 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"> 223 <div th:if="${films.isEmpty()} == false" 224 th:each="film : ${films}" class="container"> 242 225 <div class="card"> 243 226 <div class="imgBx"> 244 <img th:src=" @{${film.getUrl()}}"/>227 <img th:src=""/> 245 228 </div> 246 229 <div class="contentBx"> 247 <h2 th:text="${film.getName()}"></h2> 248 <div class="size"> 249 <h3>Duration :</h3> 250 <span th:text="${film.getDuration()}"></span> 230 <h2 th:if="${films.isEmpty()} == false" 231 th:text="${film.getName()}"></h2> 232 <div class="color"> 233 <h3>Start Date:</h3> 234 <span th:if="${films.isEmpty()} == false" 235 th:text="${film.getStart_date()}"></span> 251 236 </div> 252 <div class="color"> 253 <h3>Genre:</h3> 254 <span th:text="${film.getGenre()}"></span> 255 </div> 256 <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}" 237 <form th:if="${films.isEmpty()} == false" 238 th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}" 257 239 th:method="GET"> 258 240 <button class="button" type="submit">Details</button>
Note:
See TracChangeset
for help on using the changeset viewer.