admin
2024-01-08 22f70cc8b2ba603e82bba058db320dced48f9470
提交 | 用户 | 时间
71e81e 1 package cn.stylefeng.guns.modular.em.equipmentAlarm.controller;
2
3 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
4 import cn.stylefeng.guns.modular.em.equipmentAlarm.entity.EquipmentAlarm;
5 import cn.stylefeng.guns.modular.em.equipmentAlarm.model.params.EquipmentAlarmParam;
6 import cn.stylefeng.guns.modular.em.equipmentAlarm.service.EquipmentAlarmService;
7 import cn.stylefeng.roses.core.base.controller.BaseController;
8 import cn.stylefeng.roses.kernel.model.response.ResponseData;
9 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Controller;
12 import org.springframework.web.bind.annotation.CrossOrigin;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.ResponseBody;
15
16 import java.util.ArrayList;
17 import java.util.HashMap;
18 import java.util.List;
19 import java.util.Map;
20
21
22 /**
23  * 设备报警控制器
24  *
25  * @author cl
26  * @Date 2022-10-28 15:52:30
27  */
28 @Controller
29 @RequestMapping("/equipmentAlarm")
30 public class EquipmentAlarmController extends BaseController {
31
32     private String PREFIX = "modular/em/equipmentAlarm";
33
34     @Autowired
35     private EquipmentAlarmService equipmentAlarmService;
36
37     /**
38      * 跳转到主页面
39      *
40      * @author cl
41      * @Date 2022-10-28
42      */
43     @RequestMapping("")
44     public String index() {
45         return PREFIX + "/equipmentAlarm.html";
46     }
47
48     /**
49      * 新增页面
50      *
51      * @author cl
52      * @Date 2022-10-28
53      */
54     @RequestMapping("/add")
55     public String add() {
56         return PREFIX + "/equipmentAlarm_add.html";
57     }
58
59     /**
60      * 编辑页面
61      *
62      * @author cl
63      * @Date 2022-10-28
64      */
65     @RequestMapping("/edit")
66     public String edit() {
67         return PREFIX + "/equipmentAlarm_edit.html";
68     }
69
70     /**
71      * 新增接口
72      *
73      * @author cl
74      * @Date 2022-10-28
75      */
76     @RequestMapping("/addItem")
77     @ResponseBody
78     public ResponseData addItem(EquipmentAlarmParam equipmentAlarmParam) {
79         this.equipmentAlarmService.add(equipmentAlarmParam);
80         return ResponseData.success();
81     }
82
83     /**
84      * 编辑接口
85      *
86      * @author cl
87      * @Date 2022-10-28
88      */
89     @RequestMapping("/editItem")
90     @ResponseBody
91     public ResponseData editItem(EquipmentAlarmParam equipmentAlarmParam) {
92         this.equipmentAlarmService.update(equipmentAlarmParam);
93         return ResponseData.success();
94     }
95
96     /**
97      * 删除接口
98      *
99      * @author cl
100      * @Date 2022-10-28
101      */
102     @RequestMapping("/delete")
103     @ResponseBody
104     public ResponseData delete(EquipmentAlarmParam equipmentAlarmParam) {
105         this.equipmentAlarmService.delete(equipmentAlarmParam);
106         return ResponseData.success();
107     }
108
109     /**
110      * 查看详情接口
111      *
112      * @author cl
113      * @Date 2022-10-28
114      */
115     @RequestMapping("/detail")
116     @ResponseBody
117     public ResponseData detail(EquipmentAlarmParam equipmentAlarmParam) {
118         EquipmentAlarm detail = this.equipmentAlarmService.getById(equipmentAlarmParam.getId());
119         return ResponseData.success(detail);
120     }
121
122     /**
123      * 查询列表
124      *
125      * @author cl
126      * @Date 2022-10-28
127      */
128     @ResponseBody
129     @RequestMapping("/list")
130     public LayuiPageInfo list(EquipmentAlarmParam equipmentAlarmParam) {
131         return this.equipmentAlarmService.findPageBySpec(equipmentAlarmParam);
132     }
133
134     @ResponseBody
135     @CrossOrigin
136     @RequestMapping("/bigList")
137     public List bigList() {
138         List arrayList = new ArrayList();
139         List<EquipmentAlarm> alarmTime = equipmentAlarmService.list(new QueryWrapper<EquipmentAlarm>().orderByDesc("alarm_time"));
140         for (int i = 0; i < 10; i++) {
0d7f31 141 //            List resultList = new ArrayList();
142 //            resultList.add(alarmTime.get(i).getWorkshopCode());
143 //            resultList.add(alarmTime.get(i).getEquipmentNo());
144 //            resultList.add(alarmTime.get(i).getLocationCode());
145 //            arrayList.add(resultList);
71e81e 146             List resultList = new ArrayList();
0d7f31 147 //            resultList.add(alarmTime.get(i).getEquipmentNo());
71e81e 148             resultList.add(alarmTime.get(i).getLocationCode());
0d7f31 149             resultList.add(alarmTime.get(i).getAlarmTime());
71e81e 150             arrayList.add(resultList);
151         }
152         return arrayList;
153     }
154
155 }
156
157