This commit is contained in:
geek 2018-04-24 21:43:59 +09:00
parent 8625e10e00
commit b14796f8d3
3 changed files with 16 additions and 11 deletions

View File

@ -11,6 +11,6 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface InfraOSPortDAO extends JpaRepository<InfraOSPort, Long> {
@Query("SELECT p from com.loafle.overflow.central.module.infra.model.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);
}

View File

@ -1,10 +1,12 @@
package com.loafle.overflow.central.module.sensor.service;
import com.loafle.overflow.central.module.sensor.dao.SensorItemDependencyDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.meta.MetaSensorDisplayItem;
import com.loafle.overflow.model.meta.MetaSensorItemKey;
import com.loafle.overflow.model.sensor.SensorItemDependency;
import com.loafle.overflow.service.central.sensor.SensorItemDependencyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -17,20 +19,21 @@ import java.util.Map;
*/
@Service("SensorItemDependencyService")
public class CentralSensorItemDependencyService {
public class CentralSensorItemDependencyService implements SensorItemDependencyService {
@Autowired
private SensorItemDependencyDAO sensorItemDependencyDAO;
public SensorItemDependency regist(SensorItemDependency dependency) {
public SensorItemDependency regist(SensorItemDependency dependency) throws OverflowException {
return this.sensorItemDependencyDAO.save(dependency);
}
public List<MetaSensorItemKey> readAllByDisplayItem(MetaSensorDisplayItem displayItem) {
public List<MetaSensorItemKey> readAllByDisplayItem(MetaSensorDisplayItem displayItem) throws OverflowException {
return this.sensorItemDependencyDAO.findAllByDisplayItem(displayItem);
}
public Map<String, List<MetaSensorItemKey>> readAllByDisplayItems(List<MetaSensorDisplayItem> displayItems) {
public Map<String, List<MetaSensorItemKey>> readAllByDisplayItems(
List<MetaSensorDisplayItem> displayItems) throws OverflowException {
Map<String, List<MetaSensorItemKey>> map = new HashMap<String, List<MetaSensorItemKey>>();

View File

@ -3,10 +3,12 @@ package com.loafle.overflow.central.module.sensor.service;
import com.loafle.overflow.central.commons.utils.PageUtil;
import com.loafle.overflow.central.module.sensor.dao.SensorDAO;
import com.loafle.overflow.central.module.sensor.dao.SensorItemDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.core.model.PageParams;
import com.loafle.overflow.model.sensor.Sensor;
import com.loafle.overflow.model.sensor.SensorItem;
import com.loafle.overflow.service.central.sensor.SensorItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
@ -18,7 +20,7 @@ import java.util.List;
* Created by insanity on 17. 6. 28.
*/
@Service("SensorItemService")
public class CentralSensorItemService {
public class CentralSensorItemService implements SensorItemService {
@Autowired
private SensorItemDAO sensorItemDAO;
@ -26,7 +28,7 @@ public class CentralSensorItemService {
private SensorDAO sensorDAO;
@Transactional
public SensorItem regist(SensorItem sensorItem) {
public SensorItem regist(SensorItem sensorItem) throws OverflowException {
Sensor s = sensorDAO.findOne(sensorItem.getSensor().getId());
// s.setItemCount((short)(s.getItemCount() + 1));
this.sensorDAO.save(s);
@ -34,7 +36,7 @@ public class CentralSensorItemService {
}
@Transactional
public boolean registAll(List<SensorItem> sensorItemList) {
public boolean registAll(List<SensorItem> sensorItemList) throws OverflowException {
Sensor s = sensorDAO.findOne(sensorItemList.get(0).getSensor().getId());
// s.setItemCount((short)sensorItemList.size());
this.sensorDAO.save(s);
@ -42,16 +44,16 @@ public class CentralSensorItemService {
return true;
}
public SensorItem read(String id) {
public SensorItem read(String id) throws OverflowException {
return this.sensorItemDAO.findOne(Long.valueOf(id));
}
public Page<SensorItem> readAllBySensor(Sensor sensor, PageParams pageParams) {
public Page<SensorItem> readAllBySensor(Sensor sensor, PageParams pageParams) throws OverflowException {
return this.sensorItemDAO.findAllBySensor(sensor, PageUtil.getPageRequest(pageParams));
}
@Transactional
public void remove(SensorItem sensorItem) {
public void remove(SensorItem sensorItem) throws OverflowException {
Sensor s = sensorItem.getSensor();
// s.setItemCount((short)(s.getItemCount() - 1));
this.sensorDAO.save(s);