package org.jeecg.modules.yjComprehensiveLog.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.yjComprehensiveLog.entity.YjComprehensiveLog;
import org.jeecg.modules.yjComprehensiveLog.entity.YjComprehensiveRealLog;
import org.jeecg.modules.yjComprehensiveLog.model.YjJhComprehensiveCountModel;
import org.jeecg.modules.yjComprehensiveLog.service.YjComprehensiveLogService;
import org.jeecg.modules.yjComprehensiveLog.service.YjComprehensiveRealLogService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 配置 前端控制器
 * <p>
 *
 * @Author:
 */
@RestController
@RequestMapping("/warning/comprehensiveLog")
@Slf4j
public class YjComprehensiveLogController {


    @Resource
    private YjComprehensiveLogService comprehensiveLogService;

    /**
     * 根据时间获取单独井的各类预警数据
     *
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @param jh 井号
     * @return YjJhComprehensiveCountModel
     */
    @GetMapping("/getWarnCountByJhAndDate")
    public Result<?> getWarnCountByJhAndDate( @RequestParam(name="startDate")String startDate, @RequestParam(name="endDate") String endDate,
                               @RequestParam(name="jh") String jh){
        YjJhComprehensiveCountModel res = comprehensiveLogService.getWarnCountByJhAndDate(startDate, endDate,jh);
        return Result.OK(res);
    }

    /**
     * 根据不同的时间类型查询预警日志数据
     * @param endDate 结束时间
     * @param jh 井号
     * @param dateType 时间类型
     * @param warnType 预警类型
     * @return List<YjComprehensiveLog>
     */
    @GetMapping("/getLogByJh")
    public Result<?> getLogByJh( @RequestParam(name="endDate")String endDate,@RequestParam(name="jh") String jh, @RequestParam(name="dateType")String dateType,
                                 @RequestParam(name="warnType") String warnType){
        List<YjComprehensiveLog> res = comprehensiveLogService.getLogByJh(endDate, jh,dateType,warnType);
        return Result.OK(res);
    }

}
