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.ForecastPowerUltraShortTermCloud;
import com.cpp.web.mapper.cloud.ForecastPowerUltraShortTermCloudMapper;
import com.cpp.web.service.cloud.ForecastPowerUltraShortTermCloudService;
import org.springframework.stereotype.Service;

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

/**
 * idp_forecast_power_ultra_short_term
 *
 * @author tl
 * @date 2024-09-23 15:28:33
 */
@Service
public class ForecastPowerUltraShortTermCloudServiceImpl extends ServiceImpl<ForecastPowerUltraShortTermCloudMapper, ForecastPowerUltraShortTermCloud> implements ForecastPowerUltraShortTermCloudService {

    @Override
    public List<ForecastPowerUltraShortTermCloud> findByStationCodeAndStartTimeAndEndTime(String stationCode, Date startTime, Date endTime) {
        QueryWrapper<ForecastPowerUltraShortTermCloud> 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);
    }
}
