Changes in / [2c7a732:632e3d8]


Ignore:
Location:
src/main
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/model/manytomany/ProjectionIsPlayedInRoom.java

    r2c7a732 r632e3d8  
    2424    @Id
    2525    @Column(name ="id_projection")
    26     Integer idprojection;
     26    Integer id_projection;
    2727
    2828    @Id
    2929    @Column(name ="id_room")
    30     Integer idroom;
     30    Integer id_room;
    3131
    3232
  • src/main/java/com/example/moviezone/model/manytomany/ProjectionIsPlayedInRoomId.java

    r2c7a732 r632e3d8  
    77@Data
    88public class ProjectionIsPlayedInRoomId implements Serializable {
    9     Integer idprojection;
    10     Integer idroom;
     9    Integer id_projection;
     10    Integer id_room;
    1111}
  • src/main/java/com/example/moviezone/repository/ProjectionIsPlayedInRoomRepository.java

    r2c7a732 r632e3d8  
    1010
    1111public interface ProjectionIsPlayedInRoomRepository extends JpaRepository<ProjectionIsPlayedInRoom, ProjectionIsPlayedInRoomId> {
    12     @Query("SELECT pir FROM ProjectionIsPlayedInRoom pir WHERE pir.idprojection = :id_projection")
     12    @Query("SELECT pir FROM ProjectionIsPlayedInRoom pir WHERE pir.id_projection = :id_projection")
    1313    List<ProjectionIsPlayedInRoom> findAllByProjectionId(@Param("id_projection") Integer id_projection);
    1414}
  • src/main/java/com/example/moviezone/repository/ProjectionRepository.java

    r2c7a732 r632e3d8  
    33import com.example.moviezone.model.Projection;
    44import org.springframework.data.jpa.repository.JpaRepository;
    5 import org.springframework.data.jpa.repository.query.Procedure;
    65
    7 import javax.transaction.Transactional;
    86import java.time.LocalDate;
    97import java.util.List;
    10 @Transactional
     8
    119public interface ProjectionRepository extends JpaRepository<Projection,Integer> {
    12     @Procedure("project.getProjectionsForFilms")
    13     List<Projection> getProjectionsForFilms(int id);
     10    //    NOTE: CHANGE THIS WITH MATERIALIZED VIEW
     11    //List<Projection> findAllBydate_time_startBefore(LocalDate datum);
    1412}
  • src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java

    r2c7a732 r632e3d8  
    2626
    2727    @Override
    28     public List<Projection> getProjectionsForFilms(int id) {
    29         return projectionRepository.getProjectionsForFilms(id);
    30     }
    31 
    32     @Override
    3328    public Projection findById(Integer id_projection) {
    3429        return projectionRepository.findById(id_projection).orElseThrow(RuntimeException::new);
  • src/main/java/com/example/moviezone/service/ProjectionService.java

    r2c7a732 r632e3d8  
    99public interface ProjectionService {
    1010    List<Projection> findAllProjections();
    11     List<Projection> getProjectionsForFilms(int id);
    1211    Projection findById(Integer id_projection);
    1312Projection 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

    r2c7a732 r632e3d8  
    8585        model.addAttribute("event", event);
    8686        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");
    9787
    9888        return "master-template";
     
    178168            model.addAttribute("films",filmService.getFilmsNow());
    179169        }
    180         model.addAttribute("bodyContent","projections");
     170        model.addAttribute("bodyContent","films");
    181171        return "master-template";
    182172    }
  • src/main/resources/templates/projections.html

    r2c7a732 r632e3d8  
    194194        border-radius: 20px;
    195195    }
    196     .form-group{
    197         width: 200px;
    198     }
    199196</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>
    218197<div xmlns:th="http://www.thymeleaf.org">
    219198    <div class="main">
     
    235214                        <span th:text="${film.getGenre()}"></span>
    236215                    </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>
    242216                </div>
    243217            </div>
Note: See TracChangeset for help on using the changeset viewer.