long
2023-09-02 e379948bb83ebcc9ce0c467a7b970f74bc00e9a1
提交 | 用户 | 时间
71e81e 1 package cn.stylefeng.guns.modular.em.equipmentStatus.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.equipmentStatus.entity.EquipmentStatus;
6 import cn.stylefeng.guns.modular.em.equipmentStatus.model.params.EquipmentStatusParam;
7 import cn.stylefeng.guns.modular.em.equipmentStatus.service.EquipmentStatusService;
8 import cn.stylefeng.roses.core.base.controller.BaseController;
9 import cn.stylefeng.roses.kernel.model.response.ResponseData;
10 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Controller;
13 import org.springframework.web.bind.annotation.CrossOrigin;
14 import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.ResponseBody;
16
17 import java.util.ArrayList;
18 import java.util.HashMap;
19 import java.util.List;
20 import java.util.Map;
21
22
23 /**
24  * 设备状态控制器
25  *
26  * @author cl
27  * @Date 2022-10-28 15:48:20
28  */
29 @Controller
30 @RequestMapping("/equipmentStatus")
31 public class EquipmentStatusController extends BaseController {
32
33     private String PREFIX = "modular/em/equipmentStatus";
34
35     @Autowired
36     private EquipmentStatusService equipmentStatusService;
37
38     /**
39      * 跳转到主页面
40      *
41      * @author cl
42      * @Date 2022-10-28
43      */
44     @RequestMapping("")
45     public String index() {
46         return PREFIX + "/equipmentStatus.html";
47     }
48
49     /**
50      * 新增页面
51      *
52      * @author cl
53      * @Date 2022-10-28
54      */
55     @RequestMapping("/add")
56     public String add() {
57         return PREFIX + "/equipmentStatus_add.html";
58     }
59
60     /**
61      * 编辑页面
62      *
63      * @author cl
64      * @Date 2022-10-28
65      */
66     @RequestMapping("/edit")
67     public String edit() {
68         return PREFIX + "/equipmentStatus_edit.html";
69     }
70
71     /**
72      * 新增接口
73      *
74      * @author cl
75      * @Date 2022-10-28
76      */
77     @RequestMapping("/addItem")
78     @ResponseBody
79     public ResponseData addItem(EquipmentStatusParam equipmentStatusParam) {
80         this.equipmentStatusService.add(equipmentStatusParam);
81         return ResponseData.success();
82     }
83
84     /**
85      * 编辑接口
86      *
87      * @author cl
88      * @Date 2022-10-28
89      */
90     @RequestMapping("/editItem")
91     @ResponseBody
92     public ResponseData editItem(EquipmentStatusParam equipmentStatusParam) {
93         this.equipmentStatusService.update(equipmentStatusParam);
94         return ResponseData.success();
95     }
96
97     /**
98      * 删除接口
99      *
100      * @author cl
101      * @Date 2022-10-28
102      */
103     @RequestMapping("/delete")
104     @ResponseBody
105     public ResponseData delete(EquipmentStatusParam equipmentStatusParam) {
106         this.equipmentStatusService.delete(equipmentStatusParam);
107         return ResponseData.success();
108     }
109
110     /**
111      * 查看详情接口
112      *
113      * @author cl
114      * @Date 2022-10-28
115      */
116     @RequestMapping("/detail")
117     @ResponseBody
118     public ResponseData detail(EquipmentStatusParam equipmentStatusParam) {
119         EquipmentStatus detail = this.equipmentStatusService.getById(equipmentStatusParam.getId());
120         return ResponseData.success(detail);
121     }
122
123     /**
124      * 查询列表
125      *
126      * @author cl
127      * @Date 2022-10-28
128      */
129     @ResponseBody
130     @RequestMapping("/list")
131     public LayuiPageInfo list(EquipmentStatusParam equipmentStatusParam) {
132         return this.equipmentStatusService.findPageBySpec(equipmentStatusParam);
133     }
134
135     @ResponseBody
136     @CrossOrigin
137     @RequestMapping("/DeviceInformation")
138     public Map DeviceInformation() {
139         HashMap<String,String> map = new HashMap();
140         int count = equipmentStatusService.count();
141         int status1 = equipmentStatusService.count(new QueryWrapper<EquipmentStatus>().eq("status", "1"));
142         int status2 = equipmentStatusService.count(new QueryWrapper<EquipmentStatus>().eq("status", "2"));
143         int status3 = equipmentStatusService.count(new QueryWrapper<EquipmentStatus>().eq("status", "3"));
144         map.put("onLineQuantity", String.valueOf(status1));
145         map.put("equipmentQuantity",String.valueOf(count));
146         map.put("waitQuantity",String.valueOf(status2));
147         map.put("hitchQuantity",String.valueOf(status3));
148         return map;
149     }
150
151
152 }
153
154