bug fix
This commit is contained in:
		
							parent
							
								
									b5f0027c30
								
							
						
					
					
						commit
						548ed630b9
					
				@ -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<InfraOSPort, Long> {
 | 
			
		||||
    @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);
 | 
			
		||||
}
 | 
			
		||||
@ -11,6 +11,6 @@ import org.springframework.stereotype.Repository;
 | 
			
		||||
 */
 | 
			
		||||
@Repository
 | 
			
		||||
public interface InfraServiceDAO extends JpaRepository<InfraService, Long> {
 | 
			
		||||
    @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);
 | 
			
		||||
}
 | 
			
		||||
@ -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<SensorItem> 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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user