package com.huatek.busi.service.impl.transformer;

import java.time.LocalDateTime;

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.dao.TransformerEpaAbsIncreaseCacheDao;
import com.huatek.busi.entity.TransformerEpaAbsIncreaseCache;
import com.huatek.busi.mapper.TransformerEpaAbsIncreaseCacheMapper;
import com.huatek.busi.service.transformer.TransformerEpaAbsIncreaseCacheService;
import com.huatek.frame.base.util.BeanUtils;

/**
 * 变压器油色谱绝对产气速率暂存数据 ServiceImpl
 *
 * @author anker_cheng
 * @date Sep 26, 2019 8:59:07 PM
 */
@Component
@Service(interfaceClass = TransformerEpaAbsIncreaseCacheService.class)
@Transactional(rollbackFor = Exception.class)
public class TransformerEpaAbsIncreaseCacheServiceImpl implements TransformerEpaAbsIncreaseCacheService {

    @Autowired
    private TransformerEpaAbsIncreaseCacheMapper transformerEpaAbsIncreaseCacheMapper;
    @Autowired
    private TransformerEpaAbsIncreaseCacheDao transformerEpaAbsIncreaseCacheDao;

    @Override
    public int saveTransformerEpaAbsIncreaseCache(LocalDateTime dateTime, TransformerEpaAbsIncreaseCache param) {
        TransformerEpaAbsIncreaseCache transformerEpaAbsIncreaseCache = transformerEpaAbsIncreaseCacheMapper.getTransformerEpaAbsIncreaseCache(param);
        if(transformerEpaAbsIncreaseCache == null) {
            transformerEpaAbsIncreaseCache = new TransformerEpaAbsIncreaseCache();
        }
        BeanUtils.copyPropertiesWithIgnoreNull(param, transformerEpaAbsIncreaseCache);
        return transformerEpaAbsIncreaseCacheDao.saveOrUpdate(transformerEpaAbsIncreaseCache);
    }

}