-
懒羊羊
2024-03-23 e20d7373595960ad6be9bd6373a3c6f186e76e5c
提交 | 用户 | 时间
e57a89 1 package com.jcdm.main.em.equipmentAlarm.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
5
6 import com.jcdm.main.em.equipmentAlarm.domain.EmEquipmentAlarm;
7 import com.jcdm.main.em.equipmentAlarm.service.IEmEquipmentAlarmService;
8 import org.springframework.security.access.prepost.PreAuthorize;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.web.bind.annotation.GetMapping;
11 import org.springframework.web.bind.annotation.PostMapping;
12 import org.springframework.web.bind.annotation.PutMapping;
13 import org.springframework.web.bind.annotation.DeleteMapping;
14 import org.springframework.web.bind.annotation.PathVariable;
15 import org.springframework.web.bind.annotation.RequestBody;
16 import org.springframework.web.bind.annotation.RequestMapping;
17 import org.springframework.web.bind.annotation.RestController;
18 import com.jcdm.common.annotation.Log;
19 import com.jcdm.common.core.controller.BaseController;
20 import com.jcdm.common.core.domain.AjaxResult;
21 import com.jcdm.common.enums.BusinessType;
22 import com.jcdm.common.utils.poi.ExcelUtil;
23 import com.jcdm.common.core.page.TableDataInfo;
24
25 /**
26  * 设备报警Controller
27  * 
28  * @author ruimin
29  * @date 2023-12-15
30  */
31 @RestController
32 @RequestMapping("/em/equipmentAlarm")
33 public class EmEquipmentAlarmController extends BaseController
34 {
35     @Autowired
36     private IEmEquipmentAlarmService emEquipmentAlarmService;
37
38     /**
39      * 查询设备报警列表
40      */
41     @PreAuthorize("@ss.hasPermi('em:equipmentAlarm:list')")
42     @GetMapping("/list")
43     public TableDataInfo list(EmEquipmentAlarm emEquipmentAlarm)
44     {
45         startPage();
46         List<EmEquipmentAlarm> list = emEquipmentAlarmService.selectEmEquipmentAlarmList(emEquipmentAlarm);
47         return getDataTable(list);
48     }
49
50     /**
51      * 导出设备报警列表
52      */
53     @PreAuthorize("@ss.hasPermi('em:equipmentAlarm:export')")
54     @Log(title = "设备报警", businessType = BusinessType.EXPORT)
55     @PostMapping("/export")
56     public void export(HttpServletResponse response, EmEquipmentAlarm emEquipmentAlarm)
57     {
58         List<EmEquipmentAlarm> list = emEquipmentAlarmService.selectEmEquipmentAlarmList(emEquipmentAlarm);
59         ExcelUtil<EmEquipmentAlarm> util = new ExcelUtil<EmEquipmentAlarm>(EmEquipmentAlarm.class);
60         util.exportExcel(response, list, "设备报警数据");
61     }
62
63     /**
64      * 获取设备报警详细信息
65      */
66     @PreAuthorize("@ss.hasPermi('em:equipmentAlarm:query')")
67     @GetMapping(value = "/{id}")
68     public AjaxResult getInfo(@PathVariable("id") Long id)
69     {
70         return success(emEquipmentAlarmService.selectEmEquipmentAlarmById(id));
71     }
72
73     /**
74      * 新增设备报警
75      */
76     @PreAuthorize("@ss.hasPermi('em:equipmentAlarm:add')")
77     @Log(title = "设备报警", businessType = BusinessType.INSERT)
78     @PostMapping
79     public AjaxResult add(@RequestBody EmEquipmentAlarm emEquipmentAlarm)
80     {
81         return toAjax(emEquipmentAlarmService.insertEmEquipmentAlarm(emEquipmentAlarm));
82     }
83
84     /**
85      * 修改设备报警
86      */
87     @PreAuthorize("@ss.hasPermi('em:equipmentAlarm:edit')")
88     @Log(title = "设备报警", businessType = BusinessType.UPDATE)
89     @PutMapping
90     public AjaxResult edit(@RequestBody EmEquipmentAlarm emEquipmentAlarm)
91     {
92         return toAjax(emEquipmentAlarmService.updateEmEquipmentAlarm(emEquipmentAlarm));
93     }
94
95     /**
96      * 删除设备报警
97      */
98     @PreAuthorize("@ss.hasPermi('em:equipmentAlarm:remove')")
99     @Log(title = "设备报警", businessType = BusinessType.DELETE)
100     @DeleteMapping("/{ids}")
101     public AjaxResult remove(@PathVariable Long[] ids)
102     {
103         return toAjax(emEquipmentAlarmService.deleteEmEquipmentAlarmByIds(ids));
104     }
105 }