Merge remote-tracking branch 'origin/master'

This commit is contained in:
crusader 2017-08-14 19:08:10 +09:00
commit bacc2da529
3 changed files with 14 additions and 2 deletions

View File

@ -23,4 +23,6 @@ public interface InfraDAO extends JpaRepository<Infra, Long> {
@Query("SELECT DISTINCT i.target FROM Infra i WHERE i.probe IN (:probeList)")
List<Target> findAllTargetByProbeList(@Param("probeList") List<Probe> probeList);
// List<Infra> findAllByProbe(List<Probe> probeList);
}

View File

@ -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<Infra> readAllByDomain(Domain domain) {
List<Probe> probeList = this.probeService.readAllByDomain(domain);
return this.infraDAO.findAllByProbe(probeList);
}
public List<Infra> readAllByProbeList(List<Probe> probeList) {
return this.infraDAO.findAllByProbe(probeList);
}

View File

@ -90,9 +90,8 @@ public class InfraServiceTest {
Domain domain = new Domain();
domain.setId(1);
List<Probe> pl = this.probeService.readAllByDomain(domain);
List<Infra> fl = this.infraService.readAllByProbeList(pl);
List<Infra> fl = this.infraService.readAllByDomain(domain);
System.out.println(fl.size());