Changeset 59329aa for trip-planner/src/main/java/finki/diplomska
- Timestamp:
- 11/23/21 14:58:44 (3 years ago)
- Branches:
- master
- Children:
- e29cc2e
- Parents:
- ceaed42
- Location:
- trip-planner/src/main/java/finki/diplomska/tripplanner
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner/src/main/java/finki/diplomska/tripplanner/models/Location.java
rceaed42 r59329aa 2 2 3 3 import com.fasterxml.jackson.annotation.JsonBackReference; 4 import com.fasterxml.jackson.annotation.JsonManagedReference; 4 5 import lombok.AllArgsConstructor; 5 6 import lombok.Getter; … … 72 73 73 74 75 @OneToMany(mappedBy = "location", cascade = CascadeType.REMOVE, orphanRemoval = true) 76 @JsonManagedReference 77 private List<Images> imagesList; 78 79 74 80 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java
rceaed42 r59329aa 83 83 "(SELECT pl.id_location FROM planners_contain AS pl WHERE pl.id_planner = :plannerId)", nativeQuery = true) 84 84 List<Location> getAllLocationsForPlanner(@Param("plannerId") Long plannerId); 85 86 @Query(value = "SELECT *, if(l.id_city is NOT NULL, c.city_name, l.location_name) as result " + 87 "FROM locations AS l " + 88 "LEFT JOIN cities AS c " + 89 "ON l.id_city = c.id_city " + 90 "LEFT JOIN locations_belong AS lb " + 91 "ON l.id_location = lb.id_location " + 92 "WHERE lb.id_category=20", nativeQuery = true) 93 List<Location> getWeekendGetaways(); 94 95 @Query(value = "SELECT *, if(l.id_city is NOT NULL, c.city_name, l.location_name) as result " + 96 "FROM locations AS l " + 97 "LEFT JOIN cities AS c " + 98 "ON l.id_city = c.id_city " + 99 "LEFT JOIN locations_belong AS lb " + 100 "ON l.id_location = lb.id_location " + 101 "WHERE lb.id_category=4", nativeQuery = true) 102 List<Location> getVillages(); 85 103 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java
rceaed42 r59329aa 21 21 Location addLocationToPlanner(PlannerLocationDto plannerLocationDto); 22 22 List<Location> getAllLocationsForPlanner(Long plannerId); 23 23 List<Location> getWeekendGetaways(); 24 List<Location> getVillages(); 24 25 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java
rceaed42 r59329aa 169 169 } 170 170 171 @Override 172 public List<Location> getWeekendGetaways() { 173 return this.locationRepository.getWeekendGetaways(); 174 } 175 176 @Override 177 public List<Location> getVillages() { 178 return this.locationRepository.getVillages(); 179 } 180 171 181 172 182 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java
rceaed42 r59329aa 61 61 return this.locationService.getAllLocationsForPlanner(plannerId); 62 62 } 63 64 @GetMapping(value = "weekend") 65 public List<Location> getWeekendGetaways(){ 66 return this.locationService.getWeekendGetaways(); 67 } 68 69 @GetMapping(value = "villages") 70 public List<Location> getVillages(){ 71 return this.locationService.getVillages(); 72 } 63 73 }
Note:
See TracChangeset
for help on using the changeset viewer.