Changeset 8d49568 for src/main/java
- Timestamp:
- 02/07/23 23:14:46 (22 months ago)
- Branches:
- master
- Children:
- 64ee7f4
- Parents:
- cb5debb
- Location:
- src/main/java/com/example/moviezone
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/model/procedures/FilmsReturnTable.java
rcb5debb r8d49568 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
rcb5debb r8d49568 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/service/FilmService.java
rcb5debb r8d49568 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
rcb5debb r8d49568 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/web/HomeController.java
rcb5debb r8d49568 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; … … 35 40 36 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) { 37 42 38 43 this.filmService = filmService; 39 44 this.userService = userService; … … 127 132 128 133 } 129 130 134 @GetMapping("/films") 131 135 public String getFilmsPage(Model model){ 132 136 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 133 model.addAttribute("films",filmService.findAllFilms()); 137 List<FilmsReturnTable> pom=new LinkedList<>(); 138 model.addAttribute("films",pom); 139 boolean h=pom.isEmpty(); 140 List<FilmsReturnTable> help=filmService.getFilmsFromCinema(2); 134 141 model.addAttribute("bodyContent","films"); 135 142 return "master-template"; 136 143 } 137 144 145 public String getFilmsPage1(Model model,Integer id_cinema){ 146 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 147 if (id_cinema!=null) { 148 model.addAttribute("films",filmService.getFilmsFromCinema(id_cinema.intValue())); 149 }else{ 150 List<FilmsReturnTable> pom=new LinkedList<>(); 151 model.addAttribute("films",pom); 152 } 153 154 model.addAttribute("bodyContent","films"); 155 return "master-template"; 156 } 157 @PostMapping("/getFilmsFromCinema") 158 public String getFilmsFromCinema(@RequestParam Integer cinema, Model model){ 159 return getFilmsPage1(model,cinema); 160 } 138 161 @GetMapping("/projections") 139 162 public String getProjectionsPage(Model model)
Note:
See TracChangeset
for help on using the changeset viewer.