Last change
on this file was b738035, checked in by Ema <ema_spirova@…>, 2 years ago |
signup/login server errors on front and remove location from planner
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | package finki.diplomska.tripplanner.repository.jpa;
|
---|
2 |
|
---|
3 |
|
---|
4 | import finki.diplomska.tripplanner.models.Planner;
|
---|
5 | import org.springframework.data.jpa.repository.JpaRepository;
|
---|
6 | import org.springframework.data.jpa.repository.Query;
|
---|
7 | import org.springframework.data.repository.query.Param;
|
---|
8 | import org.springframework.stereotype.Repository;
|
---|
9 |
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 | @Repository
|
---|
13 | public interface JpaPlannerRepository extends JpaRepository<Planner, Long> {
|
---|
14 |
|
---|
15 | @Query(value = "SELECT * FROM planners AS p left JOIN users AS u ON p.user_id = u.id WHERE u.username like :username", nativeQuery = true)
|
---|
16 | List<Planner> getPlannersByUser(@Param("username") String username );
|
---|
17 |
|
---|
18 | @Query(value = "DELETE planners_contain " +
|
---|
19 | "FROM planners_contain " +
|
---|
20 | "JOIN planners ON planners_contain.id_planner = planners.id_planner " +
|
---|
21 | "JOIN locations ON planners_contain.id_location = locations.id_location " +
|
---|
22 | "WHERE planners_contain.id_planner = :plannerId AND planners_contain.id_location = :locationId", nativeQuery = true)
|
---|
23 | void deleteLocationFromPlanner(@Param("plannerId") Long plannerId, @Param("locationId") Long locationId);
|
---|
24 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.