Changeset 89438a3 for src/main/java
- Timestamp:
- 02/08/23 11:18:57 (23 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/java/com/example/moviezone
- Files:
-
- 11 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);
Note:
See TracChangeset
for help on using the changeset viewer.