Changeset a554435 for src/main/java/com
- Timestamp:
- 02/04/23 19:55:16 (23 months ago)
- Branches:
- master
- Children:
- 302b233, 4ee640e
- Parents:
- e097c1c
- Location:
- src/main/java/com/example/moviezone
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/repository/ProjectionRepository.java
re097c1c ra554435 4 4 import org.springframework.data.jpa.repository.JpaRepository; 5 5 6 import java.time.LocalDate; 7 import java.util.List; 8 6 9 public interface ProjectionRepository extends JpaRepository<Projection,Integer> { 10 // NOTE: CHANGE THIS WITH MATERIALIZED VIEW 11 List<Projection> findAllByDate_time_startBefore(LocalDate datum); 7 12 } -
src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java
re097c1c ra554435 6 6 import org.springframework.stereotype.Service; 7 7 8 import java.time.LocalDate; 8 9 import java.util.List; 9 10 … … 20 21 return projectionRepository.findAll(); 21 22 } 23 24 @Override 25 public List<Projection> findAllAvailableProjections(LocalDate date) { 26 return projectionRepository.findAllByDate_time_startBefore(date); 27 } 28 22 29 } -
src/main/java/com/example/moviezone/service/ProjectionService.java
re097c1c ra554435 3 3 import com.example.moviezone.model.Projection; 4 4 5 import java.time.LocalDate; 5 6 import java.util.List; 6 7 7 8 public interface ProjectionService { 8 9 List<Projection> findAllProjections(); 10 List<Projection> findAllAvailableProjections(LocalDate date); 11 9 12 } -
src/main/java/com/example/moviezone/web/HomeController.java
re097c1c ra554435 4 4 import com.example.moviezone.model.User; 5 5 import com.example.moviezone.model.exceptions.UserNotFoundException; 6 import com.example.moviezone.service.EventService; 6 7 import com.example.moviezone.service.FilmService; 8 import com.example.moviezone.service.ProjectionService; 7 9 import com.example.moviezone.service.UserService; 8 10 import org.springframework.stereotype.Controller; … … 14 16 15 17 import javax.servlet.http.HttpSession; 18 import java.time.LocalDate; 16 19 17 20 @Controller … … 21 24 private final FilmService filmService; 22 25 private final UserService userService; 26 private final ProjectionService projectionService; 27 private final EventService eventService; 23 28 24 public HomeController(FilmService filmService, UserService userService ) {29 public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService) { 25 30 this.filmService = filmService; 26 31 this.userService = userService; 32 this.projectionService = projectionService; 33 this.eventService = eventService; 27 34 } 28 35 … … 77 84 } 78 85 86 @GetMapping("/films") 87 public String getFilmsPage(Model model){ 88 model.addAttribute("films",filmService.findAllFilms()); 89 model.addAttribute("bodyContent","films"); 90 return "master-template"; 91 } 92 93 @GetMapping("/projections") 94 public String getProjectionsPage(Model model) 95 { 96 model.addAttribute("projections",projectionService.findAllAvailableProjections(LocalDate.now())); 97 model.addAttribute("bodyContent","projections"); 98 return "master-template"; 99 } 100 @GetMapping("/events") 101 public String getEventsPage(Model model) 102 { 103 model.addAttribute("events",eventService.findAllEvents()); 104 model.addAttribute("bodyContent","events"); 105 return "master-template"; 106 } 107 79 108 }
Note:
See TracChangeset
for help on using the changeset viewer.