package com.sckw.slope.detection.controller;

import com.alibaba.fastjson2.JSONObject;
import com.sckw.core.annotation.Log;

import com.sckw.core.web.response.HttpResult;

import com.sckw.slope.detection.model.param.AlarmInfoAdd;
import com.sckw.slope.detection.model.param.AlarmInfoQuery;


import com.sckw.slope.detection.service.KwsAlarmInfoService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author sky
 * @description 报警信息Controller
 * @date 2023-10-30 17:10:29
 */
@Slf4j
@RestController
@RequestMapping("/alarmInfo")
public class AlarmInfoController {

    @Autowired
    KwsAlarmInfoService kwsAlarmInfoService;



    @Log(description = "告警信息查询-分页")
    @RequestMapping(name = "告警信息查询-分页", value = "/select", method = RequestMethod.POST)
    public HttpResult select(@Valid @RequestBody AlarmInfoQuery query, HttpServletRequest request) {
        log.info("告警信息查询-分页 select param {}", JSONObject.toJSONString(query));
        return HttpResult.ok(kwsAlarmInfoService.select(query, request));
    }

    @Log(description = "告警信息-修改")
    @RequestMapping(name = "告警信息-修改", value = "/update", method = RequestMethod.POST)
    public HttpResult update(@Valid @RequestBody AlarmInfoAdd query, HttpServletRequest request) {
        log.info("告警信息-修改 select param {}", JSONObject.toJSONString(query));
        return HttpResult.ok(kwsAlarmInfoService.update(query, request));
    }


}
