- Timestamp:
- 10/19/21 16:40:43 (3 years ago)
- Branches:
- master
- Children:
- 6a80231
- Parents:
- eed0bf8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java
reed0bf8 r188ee53 46 46 47 47 @Query(value = "SELECT * FROM locations AS l " + 48 "LEFT JOIN recommended_companion AS rc ON l.id_location = rc.id_location " + 49 "LEFT JOIN companions AS com ON rc.id_companion = com.id_companion " + 50 "LEFT JOIN locations_belong lb ON l.id_location = lb.id_location " + 51 "LEFT JOIN categories AS cate ON lb.id_category = cate.id_category " + 52 "LEFT JOIN regions AS r" + 53 " ON l.id_region = r.id_region" + 54 " LEFT JOIN cities AS cit" + 55 " ON r.id_region = cit.id_region AND cit.id_city = l.id_city " + 56 "WHERE cit.id_city = :locationId and com.id_companion = :companionId and cate.id_category in (:categories) " + 57 "GROUP BY l.id_location " + 58 "ORDER BY CASE l.priority WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END", nativeQuery = true) 59 List<Location> findLocationsFromForm(@Param("locationId") Long locationId, @Param("companionId") Long companionId, @Param("categories") List<Long> categories); 48 "LEFT JOIN recommended_companion AS rc " + 49 "ON l.id_location = rc.id_location " + 50 "LEFT JOIN companions AS companion " + 51 "ON rc.id_companion = companion.id_companion " + 52 "LEFT JOIN locations_belong lb " + 53 "ON l.id_location = lb.id_location " + 54 "LEFT JOIN categories AS category " + 55 "ON lb.id_category = category.id_category " + 56 "LEFT JOIN cities AS city " + 57 "ON city.id_city = l.id_city " + 58 "WHERE city.id_city = :cityId and companion.id_companion = :companionId and category.id_category IN (:categoryIds) " + 59 "GROUP BY l.id_location ORDER BY CASE l.priority WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END", nativeQuery = true) 60 List<Location> findLocationsFromCityForm(@Param("cityId") Long cityId, @Param("companionId") Long companionId, @Param("categoryIds") List<Long> categoryIds); 61 62 @Query(value="SELECT * FROM locations AS location " + 63 "LEFT JOIN recommended_companion AS rc " + 64 "ON location.id_location = rc.id_location " + 65 "LEFT JOIN companions AS companion " + 66 "ON rc.id_companion = companion.id_companion " + 67 "LEFT JOIN locations_belong lb " + 68 "ON location.id_location = lb.id_location " + 69 "LEFT JOIN categories AS category " + 70 "ON lb.id_category = category.id_category " + 71 "LEFT JOIN regions AS region " + 72 "ON location.id_region = region.id_region " + 73 "LEFT JOIN cities AS city " + 74 "ON region.id_region = city.id_region " + 75 "AND city.id_city = location.id_city " + 76 "WHERE region.id_region = :regionId AND companion.id_companion = :companionId AND category.id_category IN (:categoryIds) " + 77 "GROUP BY location.id_location ORDER BY CASE location.priority WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END", nativeQuery = true) 78 List<Location> findLocationsFromRegionForm(@Param("regionId") Long regionId, @Param("companionId") Long companionId, @Param("categoryIds") List<Long> categoryIds); 60 79 }
Note:
See TracChangeset
for help on using the changeset viewer.