package com.jiayue.ipp.idp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
        com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiayue.ipp.common.data.entity.Nwp;
import com.jiayue.ipp.idp.mapper.NwpMapper;
import com.jiayue.ipp.idp.service.NwpService;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * idp_nwp
 *
 * @author whc
 * @date 2022-03-18 15:49:17
 */
@Service
public class NwpServiceImpl extends ServiceImpl<NwpMapper, Nwp> implements NwpService {


    @Override
    public QueryWrapper<Nwp> getPageByStationCodeAndeTimeBetween(String stationCode, Date startTime, Date endTime,String forecastManufactor) {
        QueryWrapper<Nwp> wrapper = new QueryWrapper<>();

        if (stationCode != null && !stationCode.equals("")) {
            wrapper.eq("station_code", stationCode);
        }
        if (startTime != null && !startTime.equals("") && endTime != null && !endTime.equals("")) {
            wrapper.between("pre_time", startTime, endTime);
        }
        if (forecastManufactor != null && !forecastManufactor.equals("")) {
            wrapper.eq("forecast_manufactor", forecastManufactor);
        }
        return wrapper;
    }
}
