package com.cpp.web.service.cloud.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cpp.web.domain.cloud.ForecastPowerShortTermCloud;
import com.cpp.web.mapper.cloud.ForecastPowerShortTermCloudMapper;
import com.cpp.web.service.cloud.ForecastPowerShortTermCloudService;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * idp_forecast_power_short_term
 *
 * @author tl
 * @date 2024-09-23 15:28:33
 */
@Service
public class ForecastPowerShortTermCloudServiceImpl extends ServiceImpl<ForecastPowerShortTermCloudMapper, ForecastPowerShortTermCloud> implements ForecastPowerShortTermCloudService {


    @Override
    public List<ForecastPowerShortTermCloud> findByStationCodeAndStartTimeAndEndTime(String stationCode, Date startTime, Date endTime) {
        QueryWrapper<ForecastPowerShortTermCloud> wrapper = new QueryWrapper<>();
        if (stationCode != null && !stationCode.equals("")) {
            wrapper.eq("station_code", stationCode);
        }
        if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
            wrapper.between("forecast_time", startTime, endTime);
        }

        return baseMapper.selectList(wrapper);
    }
    @Override
    public List<ForecastPowerShortTermCloud> findByStationCodeAndStartTimeAndEndTimeAndForecastManufactor(String stationCode, Date startTime, Date endTime, String forecastManufactor) {
        QueryWrapper<ForecastPowerShortTermCloud> wrapper = new QueryWrapper<>();
        if (stationCode != null && !stationCode.equals("")) {
            wrapper.eq("station_code", stationCode);
        }
        if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
            wrapper.between("forecast_time", startTime, endTime);
        }
        if (forecastManufactor != null && !forecastManufactor.equals("")) {
            wrapper.eq("forecast_manufactor", forecastManufactor);
        }
        return baseMapper.selectList(wrapper);
    }

}
