package com.jiayue.insu.inclientqn.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiayue.insu.inclientqn.entity.CorrforeSt;
import com.jiayue.insu.inclientqn.mapper.CorrforeStMapper;
import com.jiayue.insu.inclientqn.service.CorrforeStService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

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

/**
 * 修正数据业务实现
 *
 * @author yh
 * @version 1.0
 * @since 2022/5/22 11:29
 */
@Service
@Slf4j
public class CorrforeStServiceImpl extends ServiceImpl<CorrforeStMapper, CorrforeSt> implements CorrforeStService {


    @Override
    public boolean updateBetweenForecastTime(LocalDateTime statTime, LocalDateTime endTime, List<CorrforeSt> list) {

        try {
            LambdaQueryWrapper<CorrforeSt> remove = new LambdaQueryWrapper<>();
            remove.between(CorrforeSt::getTimeFormat,statTime,endTime);
            this.remove(remove);
            this.saveBatch(list);
            log.info("========== 数据入库成功");
        }catch (Exception e){
            e.printStackTrace();
        }
        return Boolean.TRUE;

    }
}
