package com.rongwei.bscommon.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rongwei.bscommon.sys.dao.EquEnergyMeterCenterDosageDayDao;
import com.rongwei.bscommon.sys.service.EquEnergyMeterCenterDosageDayService;
import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageDayDo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EquEnergyMeterCenterDosageDayServiceImpl  extends ServiceImpl<EquEnergyMeterCenterDosageDayDao, EquEnergyMeterCenterDosageDayDo>
        implements EquEnergyMeterCenterDosageDayService {


    @Autowired
    EquEnergyMeterCenterDosageDayService equEnergyMeterCenterDosageDayService;

    @Autowired
    EquEnergyMeterCenterDosageDayDao equEnergyMeterCenterDosageDayDao;


    @Override
    public void calRecordDataToCenterDosageDay() {
        //删除老数据
        this.deleteData();
        List<EquEnergyMeterCenterDosageDayDo> list = equEnergyMeterCenterDosageDayDao.calRecordDataToCenterDosageDay();
        if (!list.isEmpty()){
            equEnergyMeterCenterDosageDayService.saveBatch(list);
        }
    }

    /**
     * 删除老数据
     */
    private void deleteData() {
        equEnergyMeterCenterDosageDayDao.deleteData();
    }


}
