Changes in / [632e3d8:39a45e6]
- Location:
- src/main
- Files:
-
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/repository/EventRepository.java
r632e3d8 r39a45e6 2 2 3 3 import com.example.moviezone.model.Event; 4 import com.example.moviezone.model.Film;5 4 import org.springframework.data.jpa.repository.JpaRepository; 6 import org.springframework.data.jpa.repository.query.Procedure;7 8 import java.util.List;9 5 10 6 public interface EventRepository extends JpaRepository<Event,Integer> { 11 @Procedure("project.getEventsFromCinema")12 List<Event> getFilmsFromCinema(int id);13 @Procedure("project.getEventsFromNow")14 List<Event> getFilmsFromCinemaNow();15 16 7 } -
src/main/java/com/example/moviezone/repository/FilmRepository.java
r632e3d8 r39a45e6 17 17 @Procedure("project.getFilmsFromCinema1") 18 18 List<Film> getFilmsFromCinema(int id); 19 @Procedure("project.getFilmsFromCinemaNow") 20 List<Film> getFilmsFromCinemaNow(int id); 21 @Procedure("project.getFilmsNow") 22 List<Film> getFilmsNow(); 19 23 20 } -
src/main/java/com/example/moviezone/service/EventService.java
r632e3d8 r39a45e6 5 5 import java.time.LocalDate; 6 6 import java.util.List; 7 import java.util.Optional;8 7 9 8 public interface EventService { 10 9 List<Event> findAllEvents(); 11 10 Event save(LocalDate start_date,String theme,String duration,String repeating,String url); 12 List<Event> getEventsNow();13 List<Event> getEventsFromCinema(int id);14 Optional<Event> getEventById(Long id);15 11 } -
src/main/java/com/example/moviezone/service/FilmService.java
r632e3d8 r39a45e6 14 14 Optional<Film> getFilmById(Long id); 15 15 List<Film> getFilmsFromCinema(int id); 16 List<Film> getFilmsFromCinemaNow(int id);17 List<Film> getFilmsNow();18 16 } -
src/main/java/com/example/moviezone/service/Impl/EventServiceImpl.java
r632e3d8 r39a45e6 7 7 8 8 import java.time.LocalDate; 9 import java.util.Collections;10 9 import java.util.List; 11 import java.util.Optional;12 10 13 11 @Service … … 28 26 return eventRepository.save(new Event(theme,duration,repeating,start_date,img_url)); 29 27 } 30 31 @Override32 public List<Event> getEventsNow() {33 return eventRepository.getFilmsFromCinemaNow();34 }35 36 @Override37 public List<Event> getEventsFromCinema(int id) {38 return eventRepository.getFilmsFromCinema(id);39 }40 41 @Override42 public Optional<Event> getEventById(Long id) {43 return eventRepository.findAllById(Collections.singleton(id.intValue())).stream().findFirst();44 }45 28 } -
src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java
r632e3d8 r39a45e6 40 40 } 41 41 42 @Override43 public List<Film> getFilmsFromCinemaNow(int id) {44 return filmRepository.getFilmsFromCinemaNow(id);45 }46 47 @Override48 public List<Film> getFilmsNow() {49 return filmRepository.getFilmsNow();50 }51 52 42 } -
src/main/java/com/example/moviezone/web/HomeController.java
r632e3d8 r39a45e6 16 16 import org.springframework.web.bind.annotation.*; 17 17 18 import javax.naming.event.EventDirContext;19 18 import javax.servlet.http.HttpSession; 20 19 import javax.transaction.Transactional; … … 80 79 return "master-template"; 81 80 } 82 @GetMapping("/getEvent/{id}") 83 public String getEvent(@PathVariable Long id, Model model) { 84 Event event =eventService.getEventById(id).get(); 85 model.addAttribute("event", event); 86 model.addAttribute("bodyContent", "event"); 87 88 return "master-template"; 89 } 81 90 82 @GetMapping("/login") 91 83 public String getLoginPage(Model model) … … 157 149 return "master-template"; 158 150 } 159 @Transactional 151 160 152 @GetMapping("/projections") 161 public String getProjectionsPage(Model model,@RequestParam(required = false) Integer id_cinema) 162 { 163 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 164 if (id_cinema!=null) { 165 model.addAttribute("films",filmService.getFilmsFromCinemaNow(id_cinema)); 166 }else{ 167 List<FilmsReturnTable> pom=new LinkedList<>(); 168 model.addAttribute("films",filmService.getFilmsNow()); 169 } 170 model.addAttribute("bodyContent","films"); 153 public String getProjectionsPage(Model model) 154 { 155 model.addAttribute("projections",projectionService.findAllProjections()); 156 model.addAttribute("bodyContent","projections"); 171 157 return "master-template"; 172 158 } 173 159 @GetMapping("/events") 174 @Transactional 175 public String getEventsPage(Model model,@RequestParam(required = false) Integer id_cinema) 176 { 177 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 178 if (id_cinema!=null) { 179 model.addAttribute("events",eventService.getEventsFromCinema(id_cinema)); 180 }else{ 181 List<FilmsReturnTable> pom=new LinkedList<>(); 182 model.addAttribute("events",eventService.getEventsNow()); 183 } 160 public String getEventsPage(Model model) 161 { 162 model.addAttribute("events",eventService.findAllEvents()); 184 163 model.addAttribute("bodyContent","events"); 185 164 return "master-template"; -
src/main/resources/templates/events.html
r632e3d8 r39a45e6 194 194 border-radius: 20px; 195 195 } 196 .form-group{197 width: 200px;198 }199 196 </style> 200 <div>201 <form th:action="@{'/home/events'}"202 th:method="GET">203 204 <div class="form-group">205 <label style="color: white;font-size: 20px;font-weight: bold">Кино</label>206 <select name="id_cinema" class="form-control" id="id_cinema">207 <option208 th:selected="${cinemas.get(1)}"209 th:each="cinema : ${cinemas}"210 th:value="${cinema.getId_cinema()}"211 th:text="${cinema.getName()}">212 </option>213 </select>214 215 </div>216 <button class="button" type="submit">Filter</button>217 </form>218 219 197 <div xmlns:th="http://www.thymeleaf.org"> 220 <h1 style="color: white">Настани</h1>221 198 <div class="main"> 222 199 <div th:each="event : ${events}" class="container"> … … 231 208 <span th:text="${event.getDuration()}"></span> 232 209 </div> 233 <form th:action="@{'/home/get Event/{id}' (id=${event.getId_event()})}"210 <form th:action="@{'/home/getFilm/{id}' (id=${event.getId_event()})}" 234 211 th:method="GET"> 235 212 <button class="button" type="submit">Датали</button> … … 241 218 </div> 242 219 </div> 243 </div> -
src/main/resources/templates/films.html
r632e3d8 r39a45e6 219 219 220 220 <div xmlns:th="http://www.thymeleaf.org"> 221 <div class="main" style="width: available;height: available">221 <div class="main"> 222 222 <div th:if="${films.isEmpty()} == false" 223 223 th:each="film : ${films}" class="container"> -
src/main/resources/templates/projections.html
r632e3d8 r39a45e6 198 198 <div class="main"> 199 199 200 201 <div th:each="film: ${films}" class="container"> 200 <!--<div th:each="projection: ${projections}">--> 201 202 <div th:each="projection: ${projections}" class="container"> 202 203 <div class="card"> 203 204 <div class="imgBx"> 204 <img th:src="@{${ film.getUrl()}}"/>205 <img th:src="@{${projection.film.getUrl()}}"/> 205 206 </div> 206 207 <div class="contentBx"> 207 <h2 th:text="${ film.getName()}"></h2>208 <h2 th:text="${projection.film.getName()}"></h2> 208 209 <div class="size"> 209 210 <h3>Duration :</h3> 210 <span th:text="${ film.getDuration()}"></span>211 <span th:text="${projection.film.getDuration()}"></span> 211 212 </div> 212 213 <div class="color"> 213 214 <h3>Genre:</h3> 214 <span th:text="${ film.getGenre()}"></span>215 <span th:text="${projection.film.getGenre()}"></span> 215 216 </div> 216 217 </div> -
src/main/resources/templates/workers.html
r632e3d8 r39a45e6 1 1 <div xmlns:th="http://www.thymeleaf.org"> 2 <h1 style="color: white">Вработени</h1> 2 <section class="jumbotron text-center"> 3 <div class="container"> 4 <h1 class="jumbotron-heading">Вработени</h1> 5 </div> 6 </section> 7 3 8 <div class="container mb-4"> 4 9 <div class="row">
Note:
See TracChangeset
for help on using the changeset viewer.