main
|
Last change
on this file was 700e2f9, checked in by 186079 <matej.milevski@…>, 5 days ago |
|
Init
|
-
Property mode
set to
100644
|
|
File size:
855 bytes
|
| Line | |
|---|
| 1 | package com.finki.icare.repository;
|
|---|
| 2 |
|
|---|
| 3 | import com.finki.icare.model.Patient;
|
|---|
| 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.util.List;
|
|---|
| 10 |
|
|---|
| 11 | @Repository
|
|---|
| 12 | public interface PatientRepository extends JpaRepository<Patient, Integer> {
|
|---|
| 13 |
|
|---|
| 14 | @Query("SELECT CASE WHEN COUNT(p) > 0 THEN true ELSE false END FROM Patient p WHERE p.idUser = :patientId AND p.therapist.idUser = :therapistId")
|
|---|
| 15 | boolean isPatientAssignedToTherapist(@Param("patientId") Integer patientId, @Param("therapistId") Integer therapistId);
|
|---|
| 16 |
|
|---|
| 17 | @Query("SELECT p FROM Patient p WHERE p.therapist.idUser = :therapistId")
|
|---|
| 18 | List<Patient> findPatientsByTherapistId(@Param("therapistId") Integer therapistId);
|
|---|
| 19 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.