diff --git a/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java index 5c3178a..23df2ae 100644 --- a/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java +++ b/src/main/java/com/loafle/overflow/module/infra/dao/InfraDAO.java @@ -23,4 +23,6 @@ public interface InfraDAO extends JpaRepository { @Query("SELECT DISTINCT i.target FROM Infra i WHERE i.probe IN (:probeList)") List findAllTargetByProbeList(@Param("probeList") List probeList); + +// List findAllByProbe(List probeList); } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java b/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java index a936e49..90c2955 100644 --- a/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java +++ b/src/main/java/com/loafle/overflow/module/infra/service/InfraService.java @@ -4,6 +4,7 @@ import com.loafle.overflow.module.domain.model.Domain; import com.loafle.overflow.module.infra.dao.InfraDAO; import com.loafle.overflow.module.infra.model.Infra; import com.loafle.overflow.module.probe.model.Probe; +import com.loafle.overflow.module.probe.service.ProbeService; import com.loafle.overflow.module.target.model.Target; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,6 +21,9 @@ public class InfraService { @Autowired InfraDAO infraDAO; + @Autowired + private ProbeService probeService; + public Infra regist(Infra infra) { return this.infraDAO.save(infra); } @@ -32,6 +36,13 @@ public class InfraService { return this.infraDAO.findAllByProbe(probe); } + public List readAllByDomain(Domain domain) { + + List probeList = this.probeService.readAllByDomain(domain); + + return this.infraDAO.findAllByProbe(probeList); + } + public List readAllByProbeList(List probeList) { return this.infraDAO.findAllByProbe(probeList); } diff --git a/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java b/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java index 12915f3..16a8ae6 100644 --- a/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java +++ b/src/test/java/com/loafle/overflow/module/infra/service/InfraServiceTest.java @@ -90,9 +90,8 @@ public class InfraServiceTest { Domain domain = new Domain(); domain.setId(1); - List pl = this.probeService.readAllByDomain(domain); - List fl = this.infraService.readAllByProbeList(pl); + List fl = this.infraService.readAllByDomain(domain); System.out.println(fl.size());