Changes in / [89438a3:93341f8]
- Location:
- src/main
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/model/Seat.java
r89438a3 r93341f8 19 19 @ManyToOne 20 20 @JoinColumn(name = "id_room") 21 Projection_Room projection ;21 Projection_Room projection_room; 22 22 @ManyToOne 23 23 @JoinColumn(name = "id_category") -
src/main/java/com/example/moviezone/model/procedures/FilmsReturnTable.java
r89438a3 r93341f8 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 }32 20 } -
src/main/java/com/example/moviezone/repository/FilmRepository.java
r89438a3 r93341f8 7 7 import org.springframework.data.repository.query.Param; 8 8 9 import javax.transaction.Transactional;10 9 import java.util.List; 11 @Transactional 10 12 11 public interface FilmRepository extends JpaRepository<Film,Integer> { 13 12 @Procedure("project.getFilmsFromCinema") -
src/main/java/com/example/moviezone/repository/ProjectionIsPlayedInRoomRepository.java
r89438a3 r93341f8 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;8 6 9 7 import java.util.List; 10 8 11 9 public 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); 14 11 } -
src/main/java/com/example/moviezone/repository/SeatRepository.java
r89438a3 r93341f8 10 10 @Repository 11 11 public interface SeatRepository extends JpaRepository<Seat,Integer> { 12 List<Seat> findAllByProjection (Projection_Room projection);12 List<Seat> findAllByProjection_room(Projection_Room projection_room); 13 13 } -
src/main/java/com/example/moviezone/service/FilmService.java
r89438a3 r93341f8 2 2 3 3 import com.example.moviezone.model.Film; 4 import com.example.moviezone.model.procedures.FilmsReturnTable;5 4 6 5 import java.time.LocalDate; … … 13 12 String age_category, String url, String director, LocalDate start_date,LocalDate end_date); 14 13 Optional<Film> getFilmById(Long id); 15 List<FilmsReturnTable> getFilmsFromCinema(int id);16 14 } -
src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java
r89438a3 r93341f8 2 2 3 3 import com.example.moviezone.model.Film; 4 import com.example.moviezone.model.procedures.FilmsReturnTable;5 4 import com.example.moviezone.repository.FilmRepository; 6 5 import com.example.moviezone.service.FilmService; … … 35 34 } 36 35 37 @Override38 public List<FilmsReturnTable> getFilmsFromCinema(int id) {39 return filmRepository.getFilmsFromCinema(id);40 }41 42 36 } -
src/main/java/com/example/moviezone/service/Impl/ProjectionIsPlayedInRoomServiceImpl.java
r89438a3 r93341f8 1 1 package com.example.moviezone.service.Impl; 2 2 3 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;4 3 import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository; 5 4 import com.example.moviezone.service.ProjectionIsPlayedInRoomService; 6 5 import org.springframework.stereotype.Service; 7 8 import java.util.List;9 import java.util.Optional;10 6 11 7 @Service … … 17 13 } 18 14 19 @Override20 public List<ProjectionIsPlayedInRoom> getProjectionPlayedInRoom(Integer id) {21 return projectionIsPlayedInRoomRepository.findAllByProjectionId(id);22 }23 15 } -
src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java
r89438a3 r93341f8 24 24 @Override 25 25 public List<Seat> findAllByProjection_Room(Projection_Room projection_room) { 26 return seatRepository.findAllByProjection (projection_room);26 return seatRepository.findAllByProjection_room(projection_room); 27 27 } 28 28 } -
src/main/java/com/example/moviezone/service/ProjectionIsPlayedInRoomService.java
r89438a3 r93341f8 1 1 package com.example.moviezone.service; 2 2 3 import com.example.moviezone.model.Film; 4 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom; 3 public interface ProjectionIsPlayedInRoomService { 5 4 6 import java.util.List;7 import java.util.Optional;8 9 public interface ProjectionIsPlayedInRoomService {10 List<ProjectionIsPlayedInRoom> getProjectionPlayedInRoom(Integer id);11 5 12 6 } -
src/main/java/com/example/moviezone/web/HomeController.java
r89438a3 r93341f8 4 4 import com.example.moviezone.model.*; 5 5 import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException; 6 7 6 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom; 8 7 import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository; 9 10 import com.example.moviezone.model.procedures.FilmsReturnTable;11 12 8 import com.example.moviezone.service.*; 13 9 import org.springframework.format.annotation.DateTimeFormat; … … 18 14 import javax.servlet.http.HttpSession; 19 15 import java.time.LocalDate; 20 import java.util.LinkedList;21 16 import java.util.List; 22 17 import java.util.stream.Collectors; … … 36 31 private final CinemaOrganizesEventService cinemaOrganizesEventService; 37 32 private 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 { 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) { 43 37 44 38 this.filmService = filmService; … … 52 46 this.cinemaOrganizesEventService = cinemaOrganizesEventService; 53 47 this.cinemaPlaysFilmService = cinemaPlaysFilmService; 54 this.projectionIsPlayedInRoom Service = projectionIsPlayedInRoomService;48 this.projectionIsPlayedInRoomRepository = projectionIsPlayedInRoomRepository; 55 49 } 56 50 … … 133 127 134 128 } 129 135 130 @GetMapping("/films") 136 131 public String getFilmsPage(Model model){ 137 132 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()); 142 134 model.addAttribute("bodyContent","films"); 143 135 return "master-template"; 144 136 } 145 137 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 }162 138 @GetMapping("/projections") 163 139 public String getProjectionsPage(Model model) … … 286 262 287 263 288 List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoom Service.getProjectionPlayedInRoom(id_projection);264 List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomRepository.findAllById_projection(id_projection); 289 265 290 266 model.addAttribute("projection",projection); -
src/main/resources/templates/films.html
r89438a3 r93341f8 200 200 </style> 201 201 <div> 202 <form th:action="@{'/home/getFilm/{id}' (id=${film.getId_film()})}"203 th:method="POST">204 205 202 <div class="form-group"> 206 203 <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"> 208 205 <option 209 206 th:selected="${cinemas.get(1)}" … … 213 210 </option> 214 211 </select> 215 216 212 </div> 217 <button class="button" type="submit">Filter</button>218 </form>219 213 220 214 </div> 221 215 <div xmlns:th="http://www.thymeleaf.org"> 222 216 <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"> 225 242 <div class="card"> 226 243 <div class="imgBx"> 227 <img th:src=" "/>244 <img th:src="@{${film.getUrl()}}"/> 228 245 </div> 229 246 <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> 232 252 <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> 236 255 </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()})}" 239 257 th:method="GET"> 240 258 <button class="button" type="submit">Details</button>
Note:
See TracChangeset
for help on using the changeset viewer.