package com.salpa.web.controller.subject;

import com.salpa.common.core.controller.BaseController;
import com.salpa.common.core.domain.AjaxResult;
import com.salpa.common.core.page.TableDataInfo;
import com.salpa.subject.domain.MonitorWarning;
import com.salpa.subject.service.WarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 告警管理
 * @author zff
 */
@RestController
@RequestMapping("/subject/warning")
public class WarningController extends BaseController {

    @Autowired
    private WarningService warningService;

    /**
     * 获取告警列表
     * @param pageNum 页数
     * @param pageSize 条数
     * @return list
     */
    @GetMapping("list")
    public TableDataInfo warningList(Integer pageNum,Integer pageSize) {
        List<MonitorWarning> list = warningService.warningList(pageNum,pageSize);
        return getDataTable(list);
    }

    /**
     * 修改告警状态
     * @param id 告警id
     * @return 结果
     */
    @GetMapping("updateStatus")
    public AjaxResult updateStatus(Long id) {
        return toAjax(warningService.updateStatus(id));
    }
}
