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.PowerStationStatusData;
import com.jiayue.insu.incloud.entity.UltraShortTerm;
import com.jiayue.insu.incloud.mapper.PowerStationStatusDataMapper;
import com.jiayue.insu.incloud.mapper.UltraShortTermMapper;
import com.jiayue.insu.incloud.service.PowerStationStatusDataService;
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 PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationStatusDataMapper, PowerStationStatusData> implements PowerStationStatusDataService {


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

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