fixed dao query

This commit is contained in:
snoop 2017-08-22 21:01:08 +09:00
parent 2e09733eb5
commit b08e3e3b2a

View File

@ -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<Sensor, Long> {
List<Sensor> findAllByTarget(Target target);
List<Sensor> findAllByTarget(List<Target> targetList);
@Query("SELECT s from Sensor s WHERE s.target in (:targetList)")
List<Sensor> findAllByTarget(@Param("targetList") List<Target> targetList);
// List<Sensor> findAllByTargetList(List<Target> targets);
}