package org.jeecg.modules.warningThreshold.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xkcoding.http.util.StringUtil;
import org.jeecg.modules.newWarning.entity.NewWarnHistory;
import org.jeecg.modules.warningThreshold.entity.YjRealTimeLog;
import org.jeecg.modules.warningThreshold.mapper.YjRealTimeLogMapper;
import org.jeecg.modules.warningThreshold.params.YjRealTimeLogPageParams;
import org.jeecg.modules.warningThreshold.service.YjRealTimeLogService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Service
public class YjRealTimeLogServiceImpl extends ServiceImpl<YjRealTimeLogMapper, YjRealTimeLog> implements YjRealTimeLogService {

    @Resource
    private YjRealTimeLogMapper mapper;

    @Override
    public  Page<YjRealTimeLog> page(YjRealTimeLogPageParams pageParams){
        QueryWrapper<YjRealTimeLog> wrapper = new QueryWrapper<>();
        if(StringUtil.isNotEmpty(pageParams.getJh())){
            wrapper.lambda().like(YjRealTimeLog::getJh,pageParams.getJh());
        }
        if(StringUtil.isNotEmpty(pageParams.getStatus())){
            wrapper.lambda().eq(YjRealTimeLog::getStatus,pageParams.getStatus());
        }
        wrapper.lambda().orderByDesc(YjRealTimeLog::getRealTime);
        Page<YjRealTimeLog> page = new Page<>(pageParams.getPageNo(), pageParams.getPageSize());
        return  this.page(page, wrapper);
    }

}
