Ignore:
Timestamp:
10/18/21 00:19:16 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
188ee53
Parents:
fa375fe
Message:

editing location-form on frontend and backend

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java

    rfa375fe reed0bf8  
    4444            "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)
    4545    List<Location> findLocationsFromCountry(@Param("locName") String ime, @Param("companion") String companion, @Param("region") String region, @Param("categories") List<String> categories);
     46
     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);
    4660}
Note: See TracChangeset for help on using the changeset viewer.