This commit is contained in:
insanity 2017-11-15 10:47:22 +09:00
parent 65437d6183
commit 9997af8b3f

View File

@ -26,7 +26,7 @@ public class SensorItemService {
@Transactional @Transactional
public SensorItem regist(SensorItem sensorItem) { public SensorItem regist(SensorItem sensorItem) {
Sensor s = sensorItem.getSensor(); Sensor s = sensorDAO.findOne(sensorItem.getSensor().getId());
s.setItemCount((short)(s.getItemCount() + 1)); s.setItemCount((short)(s.getItemCount() + 1));
this.sensorDAO.save(s); this.sensorDAO.save(s);
return this.sensorItemDAO.save(sensorItem); return this.sensorItemDAO.save(sensorItem);
@ -34,8 +34,8 @@ public class SensorItemService {
@Transactional @Transactional
public boolean registAll(List<SensorItem> sensorItemList) { public boolean registAll(List<SensorItem> sensorItemList) {
Sensor s = sensorItemList.get(0).getSensor(); Sensor s = sensorDAO.findOne(sensorItemList.get(0).getSensor().getId());
s.setItemCount((short)(s.getItemCount() + 1)); s.setItemCount((short)sensorItemList.size());
this.sensorDAO.save(s); this.sensorDAO.save(s);
this.sensorItemDAO.save(sensorItemList); this.sensorItemDAO.save(sensorItemList);
return true; return true;