package com.usky.park.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.park.domain.AlarmGr;
import com.usky.park.service.AlarmGrService;
import com.usky.park.service.DmpDeviceService;
import com.usky.park.service.vo.AlarmGrVO;
import com.usky.park.service.vo.DmpDeviceVO;
import com.usky.park.service.vo.HistoryAttributeVO;
import org.bouncycastle.cert.ocsp.Req;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 设备信息表 前端控制器
 * </p>
 *
 * @author zyj
 * @since 2023-03-30
 */
@RestController
@RequestMapping("/alarmGr")
public class AlarmGrController {
    @Autowired
    private AlarmGrService alarmGrService;

    /**
     * 告警管理-机房系统告警
     *
     * @param deviceName 设备名称
     * @param handlingStatus 处理状态（0、未处理 1、已处理）
     * @param alarmType  告警类型
     * @param startDate 开始时间  格式 yyyy-MM-dd HH:mm:ss
     * @param endDate  结束时间  格式 yyyy-MM-dd HH:mm:ss
     * @param pageNum  当前页
     * @param pageSize  每页条数
     * @return
     */
    @GetMapping("alarmList")
    public ApiResult<CommonPage<AlarmGrVO>> alarmList(@RequestParam(value = "deviceName",required = false) String deviceName,
                                                      @RequestParam(value = "handlingStatus",required = false) Integer handlingStatus,
                                                      @RequestParam(value = "alarmType",required = false) String alarmType,
                                                      @RequestParam(value = "startDate",required = false) String startDate,
                                                      @RequestParam(value = "endDate",required = false) String endDate,
                                                      @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                      @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize){
        return ApiResult.success(alarmGrService.alarmList(deviceName,handlingStatus,alarmType,startDate,endDate,pageNum,pageSize));
    }

}

