diff --git a/src/main/java/org/springframework/samples/petclinic/disease/DiseaseRepository.java b/src/main/java/org/springframework/samples/petclinic/disease/DiseaseRepository.java index 1380b1a..841138f 100644 --- a/src/main/java/org/springframework/samples/petclinic/disease/DiseaseRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/disease/DiseaseRepository.java @@ -10,11 +10,12 @@ import org.springframework.samples.petclinic.pet.PetType; public interface DiseaseRepository extends CrudRepository { -// @Query("SELECT d FROM Disease d WHERE (d.pet_type IN :petTypes) AND (d.visit.datetime >= :startDate) AND (d.visit.datetime <= :endDate) AND (d.severity >= :diagnoses)") -// Set findEpidemicDiseases(@Param("petTypes") Set petTypes, -// @Param("startDate") LocalDateTime startDate, -// @Param("endDate") LocalDateTime endDate, -// @Param("diagnoses")Integer diagnoses); + // @Query("SELECT d FROM Disease d JOIN Visit v WHERE :petTypes MEMBER OF d.susceptiblePetTypes AND (v.datetime >= :startDate) AND (v.datetime <= :endDate) AND (d.severity >= :diagnoses)") + @Query("SELECT d FROM Disease d") + Set findEpidemicDiseases(@Param("petTypes") Set petTypes, + @Param("startDate") LocalDateTime startDate, + @Param("endDate") LocalDateTime endDate, + @Param("diagnoses")Integer diagnoses); List findAll(); }