 package com.huatek.busi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.dubbo.config.annotation.Service;
import com.huatek.busi.common.CacMonitorTypeCode;
import com.huatek.busi.mapper.IecOriginDataMapper;
import com.huatek.busi.service.IecOriginDataService;
import com.huatek.busi.vo.IecOriginDataVo;

/**
 * IEC104原始数据
 * @author buck_guo
 * @date 2019/08/15
 */

@Component                
@Service(interfaceClass = IecOriginDataService.class)
@Transactional(rollbackFor = Exception.class)
public class IecOriginDataServiceImpl implements IecOriginDataService {
    @Autowired
    private IecOriginDataMapper iecOriginDataMapper;

    @Override
    public IecOriginDataVo queryIecOriginDataBySensorCode(String sensorCode,String cacMonitorTypeCode) {
       IecOriginDataVo iecOrigin = new IecOriginDataVo();
        /**
                         * 变压器
         */
        if(CacMonitorTypeCode.TRANSFORMER_InfraredTemperature.isThis(cacMonitorTypeCode))
        {
            iecOrigin = iecOriginDataMapper.selectBytransformerSensorCode(sensorCode);
        }
        /**
         * GIS
         */
        else if(CacMonitorTypeCode.GIS_InfraredTemperature.isThis(cacMonitorTypeCode))
        {    
            iecOrigin = iecOriginDataMapper.selectByGisSensorCode(sensorCode);
        }
        /**
                         * 避雷器
         */
        else if(CacMonitorTypeCode.LIGHTNINGROD_InfraredTemperature.isThis(cacMonitorTypeCode))
        {
            iecOrigin = iecOriginDataMapper.selectByArresterSensorCode(sensorCode);
        }   
        return iecOrigin;
    }
    
}
