package com.usky.iot.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.iot.domain.BaseAlarm;
import com.usky.iot.domain.BaseAlarmNotice;
import com.usky.iot.domain.BaseAlarmType;
import com.usky.iot.service.BaseAlarmNoticeService;
import com.usky.iot.service.BaseAlarmTypeService;
import com.usky.iot.service.vo.BaseAlarmListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 * 告警通知配置 前端控制器
 * </p>
 *
 * @author han
 * @since 2023-09-19
 */
@RestController
@RequestMapping("/baseAlarmNotice")
public class BaseAlarmNoticeController {

    @Autowired
    private BaseAlarmNoticeService baseAlarmNoticeService;

    /**
     * 新增
     * @param baseAlarmNotice
     * @return
     */
    @PostMapping
    public ApiResult<Void> add(@RequestBody BaseAlarmNotice baseAlarmNotice){
        baseAlarmNoticeService.add(baseAlarmNotice);
        return ApiResult.success();
    }

    /**
     * 修改
     * @param baseAlarmNotice
     * @return
     */
    @PutMapping
    public ApiResult<Void> update(@RequestBody BaseAlarmNotice baseAlarmNotice){
        baseAlarmNoticeService.update(baseAlarmNotice);
        return ApiResult.success();
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public ApiResult<Void> remove(@PathVariable("id") Integer id){
        baseAlarmNoticeService.remove(id);
        return ApiResult.success();
    }

    /**
     * 分页
     * @param baseAlarmListVO
     * @return
     */
    @PostMapping("/page")
    public ApiResult<CommonPage<BaseAlarmNotice>> page(@RequestBody BaseAlarmListVO baseAlarmListVO){
        return ApiResult.success(baseAlarmNoticeService.page(baseAlarmListVO));
    }
}

