From 548ed630b9726394d8eff346fbe356f4f9dbbbe0 Mon Sep 17 00:00:00 2001 From: insanity Date: Tue, 24 Apr 2018 22:11:29 +0900 Subject: [PATCH] bug fix --- .../overflow/central/module/infra/dao/InfraOSPortDAO.java | 4 ++-- .../overflow/central/module/infra/dao/InfraServiceDAO.java | 2 +- .../module/sensor/service/CentralSensorItemService.java | 6 +++--- .../central/module/sensor/service/CentralSensorService.java | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java index 2c3427d..cf09d62 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraOSPortDAO.java @@ -2,7 +2,7 @@ package com.loafle.overflow.central.module.infra.dao; import com.loafle.overflow.model.infra.InfraOSPort; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; +// import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @@ -11,6 +11,6 @@ import org.springframework.stereotype.Repository; */ @Repository public interface InfraOSPortDAO extends JpaRepository { - @Query("SELECT p from InfraOSPort p WHERE p.os.id = (:osId) AND p.port = (:portNumber) AND p.portType = (:portType)") + // @Query("SELECT p from InfraOSPort p WHERE p.os.id = (:osId) AND p.port = (:portNumber) AND p.portType = (:portType)") InfraOSPort findByPort(@Param("osId") long osId,@Param("portNumber") int portNumber,@Param("portType") String portType); } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java index 94c3650..35b5a70 100644 --- a/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java +++ b/src/main/java/com/loafle/overflow/central/module/infra/dao/InfraServiceDAO.java @@ -11,6 +11,6 @@ import org.springframework.stereotype.Repository; */ @Repository public interface InfraServiceDAO extends JpaRepository { - @Query("SELECT ins from com.loafle.overflow.central.module.infra.model.InfraService ins WHERE ins.host.id = (:hostId) AND ins.port = (:portNumber) AND ins.portType = (:portType)") + @Query("SELECT ins from com.loafle.overflow.model.infra.InfraService ins WHERE ins.host.id = (:hostId) AND ins.port = (:portNumber) AND ins.portType = (:portType)") InfraService findByService(@Param("hostId") long hostId,@Param("portNumber") int portNumber,@Param("portType") String portType); } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java index 720b5e9..80149d0 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorItemService.java @@ -30,7 +30,7 @@ public class CentralSensorItemService implements SensorItemService { @Transactional public SensorItem regist(SensorItem sensorItem) throws OverflowException { Sensor s = sensorDAO.findOne(sensorItem.getSensor().getId()); - // s.setItemCount((short)(s.getItemCount() + 1)); + s.setItemCount((short)(s.getItemCount() + 1)); this.sensorDAO.save(s); return this.sensorItemDAO.save(sensorItem); } @@ -38,7 +38,7 @@ public class CentralSensorItemService implements SensorItemService { @Transactional public boolean registAll(List sensorItemList) throws OverflowException { Sensor s = sensorDAO.findOne(sensorItemList.get(0).getSensor().getId()); - // s.setItemCount((short)sensorItemList.size()); + s.setItemCount((short)sensorItemList.size()); this.sensorDAO.save(s); this.sensorItemDAO.save(sensorItemList); return true; @@ -55,7 +55,7 @@ public class CentralSensorItemService implements SensorItemService { @Transactional public void remove(SensorItem sensorItem) throws OverflowException { Sensor s = sensorItem.getSensor(); - // s.setItemCount((short)(s.getItemCount() - 1)); + s.setItemCount((short)(s.getItemCount() - 1)); this.sensorDAO.save(s); this.sensorItemDAO.delete(sensorItem); } diff --git a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java index 547d2d1..6267e6c 100644 --- a/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java +++ b/src/main/java/com/loafle/overflow/central/module/sensor/service/CentralSensorService.java @@ -14,6 +14,7 @@ import com.loafle.overflow.model.sensor.SensorItem; import com.loafle.overflow.model.target.Target; import com.loafle.overflow.service.central.infra.InfraService; import com.loafle.overflow.service.central.probe.ProbeService; +import com.loafle.overflow.service.central.sensor.SensorItemService; import com.loafle.overflow.service.central.sensor.SensorService; import org.springframework.beans.factory.annotation.Autowired; @@ -39,7 +40,7 @@ public class CentralSensorService implements SensorService { private InfraService infraService; @Autowired - private CentralSensorItemService sensorItemService; + private SensorItemService sensorItemService; @Autowired private SensorConfigGenerator sensorConfigGenerator;