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.TransformerEpaIncreaseCacheDao;
import com.huatek.busi.entity.TransformerEpaIncreaseCache;
import com.huatek.busi.mapper.TransformerEpaIncreaseCacheMapper;
import com.huatek.busi.service.transformer.TransformerEpaIncreaseCacheService;
import com.huatek.frame.base.util.BeanUtils;

/**
 * 变压器油色谱增长率暂存数据（类型编码 ：021002） ServiceImpl
 *
 * @author anker_cheng
 * @date Jul 15, 2019 11:13:56 AM
 */
@Component
@Service(interfaceClass = TransformerEpaIncreaseCacheService.class)
@Transactional(rollbackFor = Exception.class)
public class TransformerEpaIncreaseCacheServiceImpl implements TransformerEpaIncreaseCacheService {

    @Autowired
    private TransformerEpaIncreaseCacheMapper transformerEpaIncreaseCacheMapper;
    @Autowired
    private TransformerEpaIncreaseCacheDao transformerEpaIncreaseCacheDao;

    @Override
    public void saveTransformerEpaIncreaseCache(LocalDateTime beforeDate, TransformerEpaIncreaseCache param) {
        TransformerEpaIncreaseCache transformerEpaIncreaseCache = transformerEpaIncreaseCacheMapper.getTransformerEpaIncreaseCache(param);
        if(transformerEpaIncreaseCache == null) {
            transformerEpaIncreaseCache = new TransformerEpaIncreaseCache();
        }
        BeanUtils.copyPropertiesWithIgnoreNull(param, transformerEpaIncreaseCache);
        transformerEpaIncreaseCacheDao.saveOrUpdate(transformerEpaIncreaseCache);
    }
}