Last change
on this file was 07fe0be, checked in by ste08 <sjovanoska@…>, 3 months ago |
Wishlist fully working, can book and pay for the booking.
|
-
Property mode
set to
100644
|
File size:
993 bytes
|
Line | |
---|
1 | package com.example.skychasemk.repository;
|
---|
2 |
|
---|
3 | import com.example.skychasemk.model.Flight;
|
---|
4 | import org.springframework.data.jpa.repository.JpaRepository;
|
---|
5 | import org.springframework.data.jpa.repository.Query;
|
---|
6 | import org.springframework.data.repository.query.Param;
|
---|
7 | import org.springframework.stereotype.Repository;
|
---|
8 |
|
---|
9 | import java.time.LocalDate;
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 | @Repository
|
---|
13 | public interface FlightRepository extends JpaRepository<Flight, Long> {
|
---|
14 |
|
---|
15 | @Query(value = "SELECT * FROM flight WHERE departure_airport = :departureID AND arrival_airport = :destinationID AND departure_date = :departureDate", nativeQuery = true)
|
---|
16 | List<Flight> findFlights(@Param("departureID") Integer departureID,
|
---|
17 | @Param("destinationID") Integer destinationID,
|
---|
18 | @Param("departureDate") LocalDate departureDate);
|
---|
19 |
|
---|
20 |
|
---|
21 | @Query(value="SELECT * FROM flight WHERE flightId=:flightId",nativeQuery = true)
|
---|
22 | List<Flight> getFlightByFlightId(Long flightId);
|
---|
23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.