Last change
on this file since 950fa0d was 950fa0d, checked in by Gjoko Kostadinov <gjoko.kostadinov@…>, 14 months ago |
Periodic update
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[950fa0d] | 1 | package edu.gjoko.schedlr.repositories;
|
---|
| 2 |
|
---|
| 3 | import edu.gjoko.schedlr.entity.Appointment;
|
---|
| 4 | import edu.gjoko.schedlr.entity.Business;
|
---|
| 5 | import edu.gjoko.schedlr.entity.Stakeholder;
|
---|
| 6 | import org.springframework.data.jpa.repository.JpaRepository;
|
---|
| 7 | import org.springframework.data.jpa.repository.Query;
|
---|
| 8 | import org.springframework.stereotype.Repository;
|
---|
| 9 |
|
---|
| 10 | import java.time.LocalDateTime;
|
---|
| 11 | import java.util.List;
|
---|
| 12 |
|
---|
| 13 | @Repository
|
---|
| 14 | public interface AppointmentRepository extends JpaRepository<Appointment, Long> {
|
---|
| 15 |
|
---|
| 16 | List<Appointment> getAppointmentsByBusiness(Business business);
|
---|
| 17 |
|
---|
| 18 | List<Appointment> getAppointmentsByCustomer(Stakeholder customer);
|
---|
| 19 |
|
---|
| 20 | List<Appointment> findAppointmentsByBusinessAndStartTimeBetweenOrEndTimeBetween(Business business, LocalDateTime startTime, LocalDateTime endTime, LocalDateTime startTime1, LocalDateTime endTime1);
|
---|
| 21 |
|
---|
| 22 | @Query(value = "select a from Appointment a " +
|
---|
| 23 | "where business_id = :businessId " +
|
---|
| 24 | "and (" +
|
---|
| 25 | "(start_time between :startDate and :endDate) " +
|
---|
| 26 | "or (end_time between :startDate and :endDate) " +
|
---|
| 27 | "or (:startDate <= start_time and end_time >= :endDate)" +
|
---|
| 28 | ")", nativeQuery = true)
|
---|
| 29 | List<Appointment> findBlockingAppointments(Long businessId, LocalDateTime startDate, LocalDateTime endDate);
|
---|
| 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.