Ignore:
Timestamp:
11/23/21 14:58:44 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
e29cc2e
Parents:
ceaed42
Message:

adding photos

Location:
trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa
Files:
1 added
1 edited

Legend:

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

    rceaed42 r59329aa  
    8383            "(SELECT pl.id_location FROM planners_contain AS pl WHERE pl.id_planner = :plannerId)", nativeQuery = true)
    8484    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();
    85103}
Note: See TracChangeset for help on using the changeset viewer.