 package com.huimv.management.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.huimv.management.entity.ThresholdManagementEntity;
import com.huimv.management.service.ThresholdManagementService;
import com.huimv.common.utils.PageUtils;
import com.huimv.common.utils.R;

/**
 * <p>
 * 报警阈值管理Controller
 * </p>
 *
 * @author yinhao
 * @version 1.0
 * @date 2021-06-15 13:01:37
 */
@Api(tags = "报警阈值管理Controller")
@RestController
@RequestMapping("management/thresholdManagement")
public class ThresholdManagementController {

    @Autowired
    private ThresholdManagementService thresholdManagementService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = thresholdManagementService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		ThresholdManagementEntity thresholdManagement = thresholdManagementService.getById(id);

        return R.ok().put("thresholdManagement", thresholdManagement);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody ThresholdManagementEntity thresholdManagement){
		thresholdManagementService.save(thresholdManagement);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody ThresholdManagementEntity thresholdManagement){
		thresholdManagementService.updateById(thresholdManagement);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		thresholdManagementService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
