package com.securitycontrol.screen.controller;

import com.github.pagehelper.PageInfo;
import com.securitycontrol.common.core.constant.HttpStatus;
import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.core.web.page.TableDataInfo;
import com.securitycontrol.common.log.annotation.Log;
import com.securitycontrol.common.log.enums.OperationType;
import com.securitycontrol.entity.background.dto.DeviceDto;
import com.securitycontrol.entity.background.vo.DeviceVo;
import com.securitycontrol.entity.screen.dto.AlarmMgeDto;
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
import com.securitycontrol.entity.screen.vo.AlarmMgeVo;
import com.securitycontrol.screen.service.AlarmMgeService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

import static com.securitycontrol.common.core.utils.PageUtils.startPage;

/**
 * 告警管理
 * @author lsun
 */
@RestController
@RequestMapping("/largeScreen/alarmMge/")
@Slf4j
public class AlarmMgeController extends BaseController {
    @Resource(name = "AlarmMgeService")
    private AlarmMgeService service;

    @ApiOperation(value = "告警管理列表")
    @GetMapping("getAlarmMgeList")
    @Log(title = "告警管理", menu = "告警管理->告警管理", grade = OperationType.QUERY_BUSINESS, details = "查询告警管理列表", type = "业务日志")
    public TableDataInfo getAlarmMgeList(AlarmMgeDto dto) {
        try{
            startLayPage();
            List<AlarmMgeVo> list = service.getAlarmMgeList(dto);
            return getDataTableLayui(list);
        }catch (Exception e){
            log.error(e.toString(),e);
            return getDataTableBadLayui(new ArrayList<>(),"请求出错了");
        }
    }

}
