`
This commit is contained in:
parent
8693503077
commit
7024141849
|
@ -1,15 +1,24 @@
|
||||||
package com.loafle.overflow.central.module.probe.dao;
|
package com.loafle.overflow.central.module.probe.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.loafle.overflow.model.domain.Domain;
|
||||||
import com.loafle.overflow.model.probe.Probe;
|
import com.loafle.overflow.model.probe.Probe;
|
||||||
import com.loafle.overflow.model.probe.ProbeHost;
|
import com.loafle.overflow.model.probe.ProbeHost;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
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 org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by snoop on 17. 8. 21.
|
* Created by snoop on 17. 8. 21.
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface ProbeHostDAO extends JpaRepository<ProbeHost, Long> {
|
public interface ProbeHostDAO extends JpaRepository<ProbeHost, Long> {
|
||||||
ProbeHost findByProbe(Probe probe);
|
ProbeHost findByProbe(Probe probe);
|
||||||
|
|
||||||
|
@Query("SELECT h FROM ProbeHost h WHERE h.probe.domain = (:domain)")
|
||||||
|
List<ProbeHost> findAllByDomain(@Param("domain")Domain domain);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
package com.loafle.overflow.central.module.probe.service;
|
package com.loafle.overflow.central.module.probe.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.loafle.overflow.central.module.probe.dao.ProbeHostDAO;
|
import com.loafle.overflow.central.module.probe.dao.ProbeHostDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
|
import com.loafle.overflow.model.domain.Domain;
|
||||||
import com.loafle.overflow.model.probe.Probe;
|
import com.loafle.overflow.model.probe.Probe;
|
||||||
import com.loafle.overflow.model.probe.ProbeHost;
|
import com.loafle.overflow.model.probe.ProbeHost;
|
||||||
import com.loafle.overflow.service.central.probe.ProbeHostService;
|
import com.loafle.overflow.service.central.probe.ProbeHostService;
|
||||||
|
@ -18,6 +21,10 @@ public class CentralProbeHostService implements ProbeHostService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProbeHostDAO probeHostDAO;
|
private ProbeHostDAO probeHostDAO;
|
||||||
|
|
||||||
|
public ProbeHost read(long id) throws OverflowException {
|
||||||
|
return this.probeHostDAO.findOne(id);
|
||||||
|
}
|
||||||
|
|
||||||
public ProbeHost readByProbe(Probe probe) throws OverflowException {
|
public ProbeHost readByProbe(Probe probe) throws OverflowException {
|
||||||
return this.probeHostDAO.findByProbe(probe);
|
return this.probeHostDAO.findByProbe(probe);
|
||||||
}
|
}
|
||||||
|
@ -25,4 +32,9 @@ public class CentralProbeHostService implements ProbeHostService {
|
||||||
public ProbeHost regist(ProbeHost probeHost) throws OverflowException {
|
public ProbeHost regist(ProbeHost probeHost) throws OverflowException {
|
||||||
return this.probeHostDAO.save(probeHost);
|
return this.probeHostDAO.save(probeHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ProbeHost> readAllByDomain(Domain domain) throws OverflowException {
|
||||||
|
return this.probeHostDAO.findAllByDomain(domain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user