diff --git a/src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java b/src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java index 9211142..1334652 100644 --- a/src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java +++ b/src/main/java/com/loafle/overflow/module/sensor/service/SensorItemService.java @@ -26,7 +26,7 @@ public class SensorItemService { @Transactional public SensorItem regist(SensorItem sensorItem) { - Sensor s = sensorItem.getSensor(); + Sensor s = sensorDAO.findOne(sensorItem.getSensor().getId()); s.setItemCount((short)(s.getItemCount() + 1)); this.sensorDAO.save(s); return this.sensorItemDAO.save(sensorItem); @@ -34,8 +34,8 @@ public class SensorItemService { @Transactional public boolean registAll(List sensorItemList) { - Sensor s = sensorItemList.get(0).getSensor(); - s.setItemCount((short)(s.getItemCount() + 1)); + Sensor s = sensorDAO.findOne(sensorItemList.get(0).getSensor().getId()); + s.setItemCount((short)sensorItemList.size()); this.sensorDAO.save(s); this.sensorItemDAO.save(sensorItemList); return true;