package cn.cecep.talroad.service.impl;

import java.util.Date;
import java.util.List;
import cn.cecep.talroad.domain.SEnvGasMonReal;
import cn.cecep.talroad.vo.query.EarlyWarningQuery;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.cecep.talroad.domain.EarlyWarning;
import cn.cecep.talroad.mapper.EarlyWarningMapper;
import cn.cecep.talroad.service.IEarlyWarningService;
import cn.cecep.talroad.mapper.EarlyWarningMapper;
import cn.cecep.talroad.domain.EarlyWarning;
import cn.cecep.talroad.service.IEarlyWarningService;




/**
 * 管控浓度超标预警Service业务层处理
 *
 * @author szhpt
 * @date 2023-04-24*/
@Service
public class EarlyWarningServiceImpl extends ServiceImpl<EarlyWarningMapper,EarlyWarning> implements IEarlyWarningService
{
    @Autowired
    private EarlyWarningMapper earlyWarningMapper;

    /**
     * 查询管控浓度超标预警列表
     *
     * @param earlyWarning 管控浓度超标预警
     * @return 管控浓度超标预警
     */
    @Override
    public List<EarlyWarning> selectEarlyWarningList(EarlyWarningQuery earlyWarning)
    {
        DateTime startTime = DateUtil.parse(earlyWarning.getStartWarningTime(), "yyyy-MM-dd HH:mm:ss");
        DateTime endTime = DateUtil.parse(earlyWarning.getEndWarningTime(), "yyyy-MM-dd HH:mm:ss");
        return earlyWarningMapper.selectEarlyWarningList(new Page<EarlyWarning>(1,999999), earlyWarning, new QueryWrapper<EarlyWarning>().orderByDesc("warning_time"),startTime,endTime);
    }
    
}
