From b08e3e3b2ad7ad680018a2e2c5fa405967c567db Mon Sep 17 00:00:00 2001 From: snoop Date: Tue, 22 Aug 2017 21:01:08 +0900 Subject: [PATCH] fixed dao query --- .../com/loafle/overflow/module/sensor/dao/SensorDAO.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/module/sensor/dao/SensorDAO.java b/src/main/java/com/loafle/overflow/module/sensor/dao/SensorDAO.java index ad20dba..fea4c54 100644 --- a/src/main/java/com/loafle/overflow/module/sensor/dao/SensorDAO.java +++ b/src/main/java/com/loafle/overflow/module/sensor/dao/SensorDAO.java @@ -5,6 +5,8 @@ import com.loafle.overflow.module.probe.model.Probe; import com.loafle.overflow.module.sensor.model.Sensor; import com.loafle.overflow.module.target.model.Target; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import java.util.List; @@ -16,6 +18,7 @@ import java.util.List; public interface SensorDAO extends JpaRepository { List findAllByTarget(Target target); - List findAllByTarget(List targetList); + @Query("SELECT s from Sensor s WHERE s.target in (:targetList)") + List findAllByTarget(@Param("targetList") List targetList); // List findAllByTargetList(List targets); }