- Timestamp:
- 02/08/23 15:48:51 (22 months ago)
- Branches:
- master
- Children:
- 2c7a732
- Parents:
- 90317ea
- Location:
- src/main
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/model/manytomany/ProjectionIsPlayedInRoom.java
r90317ea r5867520 24 24 @Id 25 25 @Column(name ="id_projection") 26 Integer id _projection;26 Integer idprojection; 27 27 28 28 @Id 29 29 @Column(name ="id_room") 30 Integer id _room;30 Integer idroom; 31 31 32 32 -
src/main/java/com/example/moviezone/model/manytomany/ProjectionIsPlayedInRoomId.java
r90317ea r5867520 7 7 @Data 8 8 public class ProjectionIsPlayedInRoomId implements Serializable { 9 Integer id _projection;10 Integer id _room;9 Integer idprojection; 10 Integer idroom; 11 11 } -
src/main/java/com/example/moviezone/repository/ProjectionIsPlayedInRoomRepository.java
r90317ea r5867520 10 10 11 11 public interface ProjectionIsPlayedInRoomRepository extends JpaRepository<ProjectionIsPlayedInRoom, ProjectionIsPlayedInRoomId> { 12 @Query("SELECT pir FROM ProjectionIsPlayedInRoom pir WHERE pir.id _projection = :id_projection")12 @Query("SELECT pir FROM ProjectionIsPlayedInRoom pir WHERE pir.idprojection = :id_projection") 13 13 List<ProjectionIsPlayedInRoom> findAllByProjectionId(@Param("id_projection") Integer id_projection); 14 14 } -
src/main/java/com/example/moviezone/repository/ProjectionRepository.java
r90317ea r5867520 3 3 import com.example.moviezone.model.Projection; 4 4 import org.springframework.data.jpa.repository.JpaRepository; 5 import org.springframework.data.jpa.repository.query.Procedure; 5 6 7 import javax.transaction.Transactional; 6 8 import java.time.LocalDate; 7 9 import java.util.List; 8 10 @Transactional 9 11 public interface ProjectionRepository extends JpaRepository<Projection,Integer> { 10 // NOTE: CHANGE THIS WITH MATERIALIZED VIEW11 //List<Projection> findAllBydate_time_startBefore(LocalDate datum);12 @Procedure("project.getProjectionsForFilms") 13 List<Projection> getProjectionsForFilms(int id); 12 14 } -
src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java
r90317ea r5867520 26 26 27 27 @Override 28 public List<Projection> getProjectionsForFilms(int id) { 29 return projectionRepository.getProjectionsForFilms(id); 30 } 31 32 @Override 28 33 public Projection findById(Integer id_projection) { 29 34 return projectionRepository.findById(id_projection).orElseThrow(RuntimeException::new); -
src/main/java/com/example/moviezone/service/ProjectionService.java
r90317ea r5867520 9 9 public interface ProjectionService { 10 10 List<Projection> findAllProjections(); 11 List<Projection> getProjectionsForFilms(int id); 11 12 Projection findById(Integer id_projection); 12 13 Projection save(LocalDate date_time_start,LocalDate date_time_end, String type_of_technology, Integer id_film ); -
src/main/java/com/example/moviezone/web/HomeController.java
r90317ea r5867520 85 85 model.addAttribute("event", event); 86 86 model.addAttribute("bodyContent", "event"); 87 88 return "master-template"; 89 } 90 @GetMapping("/getProjections/{id}") 91 @Transactional 92 public String getProjectionsFromFilm(@PathVariable Long id, Model model) { 93 Film film=filmService.getFilmById(id).get(); 94 model.addAttribute("film",film); 95 model.addAttribute("projections",projectionService.getProjectionsForFilms(id.intValue())); 96 model.addAttribute("bodyContent", "projectionsForFilm"); 87 97 88 98 return "master-template"; … … 168 178 model.addAttribute("films",filmService.getFilmsNow()); 169 179 } 170 model.addAttribute("bodyContent"," films");180 model.addAttribute("bodyContent","projections"); 171 181 return "master-template"; 172 182 } -
src/main/resources/templates/projections.html
r90317ea r5867520 194 194 border-radius: 20px; 195 195 } 196 .form-group{ 197 width: 200px; 198 } 196 199 </style> 200 <div> 201 <form th:action="@{'/home/projections'}" 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 <option 208 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> 197 218 <div xmlns:th="http://www.thymeleaf.org"> 198 219 <div class="main"> … … 214 235 <span th:text="${film.getGenre()}"></span> 215 236 </div> 237 <form 238 th:action="@{'/home/getProjections/{id}' (id=${film.getId_film()})}" 239 th:method="GET"> 240 <button class="button" type="submit">Projections</button> 241 </form> 216 242 </div> 217 243 </div>
Note:
See TracChangeset
for help on using the changeset viewer.