source: src/main/java/com/example/medweb/repository/TerminRepository.java

Last change on this file was e5fefbd, checked in by Anita Terziska <63020646+Nit4e@…>, 2 years ago

initial commit

  • Property mode set to 100644
File size: 1007 bytes
Line 
1package com.example.medweb.repository;
2
3import com.example.medweb.model.Termin;
4import com.example.medweb.model.TerminId;
5import org.springframework.data.jpa.repository.JpaRepository;
6import org.springframework.data.jpa.repository.Query;
7import org.springframework.stereotype.Component;
8import org.springframework.stereotype.Repository;
9
10import java.time.ZonedDateTime;
11import java.util.List;
12import java.util.Optional;
13
14
15@Repository
16@Component("main")
17public interface TerminRepository extends JpaRepository<Termin, TerminId>, TerminRepositoryCustom {
18
19 @Query("select t from Termin t left join Rezervacija r on t.termin_id = r.termin.termin_id where t.vreme > :now and r.termin is null")
20 List<Termin> findFutureAndFree (ZonedDateTime now);
21
22 @Query("select t from Termin t left join Rezervacija r on t.termin_id = r.termin.termin_id where t.vreme > :now and t.doktor_id = :doktor_id and r.termin is null")
23 List<Termin> findFutureAndFreeAndByDoktor (ZonedDateTime now, Integer doktor_id);
24
25}
Note: See TracBrowser for help on using the repository browser.