/*
 * Author: wangjian
 * 生成ServiceImpl
 */
package com.tofly.scada.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tofly.scada.entity.OsmRecords;
import com.tofly.scada.mapper.OsmRecordsMapper;
import com.tofly.scada.service.OsmRecordsService;
import com.tofly.scada.service.StatisticsScadaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import javax.xml.crypto.Data;
import java.util.Date;
import java.util.List;

/**
 * 区域表管理信息表：TF_YWPN_DMATABLE_W
 *
 * @author admin
 * @date Tue May 18 00:00:00 CST 2021
 */
@Service("osmRecordsService")
public class OsmRecordsServiceImpl extends ServiceImpl<OsmRecordsMapper, OsmRecords> implements OsmRecordsService {

    @Override
    @Async
    public void synData(Date start, Date end) {
       List<OsmRecords> list=  this.baseMapper.synData(start,end);
        if(list!=null && list.size()>0){
            super.baseMapper.delete(Wrappers.<OsmRecords>lambdaQuery()
                    .between(OsmRecords::getFinancialDate,start,end));
            super.saveOrUpdateBatch(list);
        }
    }
}
