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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiayue.insu.incloud.entity.UltraShortTerm;
import com.jiayue.insu.incloud.mapper.UltraShortTermMapper;
import com.jiayue.insu.incloud.service.UltraShortTermService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 超短期数据业务实现
 *
 * @author yh
 * @version 1.0
 * @since 2022/5/22 11:29
 */
@Service
public class UltraShortTermServiceImpl extends ServiceImpl<UltraShortTermMapper, UltraShortTerm> implements UltraShortTermService {


    /**
     *  根据生成时间查询超短期数据
     * @param genDate
     * @param stationCode
     * @return
     */
    @Override
    public List<UltraShortTerm> findByGenDate(Long genDate,String stationCode) {
        LambdaQueryWrapper<UltraShortTerm> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(UltraShortTerm::getGenDate,genDate);
        lambdaQueryWrapper.eq(UltraShortTerm::getStationCode,stationCode);
        return this.list(lambdaQueryWrapper);
    }

    @Override
    public void save(List<UltraShortTerm> list) {
        this.saveOrUpdateBatch(list);
    }
}
