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

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

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.BusiTransfromTemperatureExcessDao;
import com.huatek.busi.entity.BusiTransfromTemperatureExcess;
import com.huatek.busi.mapper.BusiTransfromTemperatureExcessMapper;
import com.huatek.busi.service.BusiTransfromTemperatureExcessService;

/**
 * 变压器红外测温时间 ServiceImpl
 *
 * @author anker_cheng
 * @date Jun 28, 2019 1:21:03 PM
 */
@Component
@Service(interfaceClass = BusiTransfromTemperatureExcessService.class)
@Transactional(rollbackFor = Exception.class)
public class BusiTransfromTemperatureExcessServiceImpl implements BusiTransfromTemperatureExcessService {

    @Autowired
    private BusiTransfromTemperatureExcessMapper busiTransfromTemperatureExcessMapper;
    @Autowired
    private BusiTransfromTemperatureExcessDao busiTransfromTemperatureExcessDao;

    @Override
    public int saveOrUpdate(BusiTransfromTemperatureExcess entity) {
        if (entity.getCreatedTime() == null) {
            entity.setCreatedTime(LocalDateTime.now());
        }
        return busiTransfromTemperatureExcessDao.saveOrUpdate(entity);
    }

    @Override
    public BusiTransfromTemperatureExcess findBusiTransfromTemperatureExcess(String siteId, String siteEqmCode) {
        return busiTransfromTemperatureExcessMapper.getBusiTransfromTemperatureExcess(siteId, siteEqmCode);
    }
    
    @Override
	public List<BusiTransfromTemperatureExcess> getEvalatuData(String mainEquipmentId, Date start, Date end) {
		return busiTransfromTemperatureExcessMapper.getEvalatuData( mainEquipmentId,  start,  end);
	}
}