whyczh
2021-05-14 fd2d92448a1fa0031daa0e05c739109093acdc3f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.whyc.controller;
 
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.AlarmRule;
import com.whyc.service.AlarmRuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
@RestController
@RequestMapping("alarmRule")
@Api(tags = "告警规则")
public class AlarmRuleController {
 
    @Autowired
    private AlarmRuleService service;
 
    @GetMapping("byDeviceFlag")
    @ApiOperation(value = "查询告警规则-根据id",notes ="主要设备:\n" +
            " 101-电源,102-主流配电板,103-受势电机,104测功电机\n" +
            "辅助设备:\n" +
            " 201-进线屏,205-直流调速柜,206-振动测试系统,207-AFE变频驱动柜,\n" +
            " 208-升压变压器,209-油站,210-水站,211-UPS\n" +
            "环境设备:\n" +
            " 301-水质监测,302-漏水监测,303-绝缘监测"
    )
    public Response<List<AlarmRule>> getRuleByDeviceFlag(
            @RequestParam int deviceFlag){
 
        return service.getRuleByDeviceFlag(deviceFlag);
    }
 
    @PostMapping
    @ApiOperation(value = "新增规则")
    public Response add(@RequestBody AlarmRule alarmRule){
        return service.add(alarmRule);
    }
 
    @PutMapping
    @ApiOperation(value = "更新规则")
    public Response update(@RequestBody AlarmRule alarmRule){
        return service.update(alarmRule);
    }
 
    @DeleteMapping
    @ApiOperation(value = "删除规则")
    public Response delete(@RequestParam int id){
        return service.delete(id);
    }
}