package cn.stylefeng.guns.modular.em.equipmentAlarm.controller; import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo; import cn.stylefeng.guns.modular.em.equipmentAlarm.entity.EquipmentAlarm; import cn.stylefeng.guns.modular.em.equipmentAlarm.model.params.EquipmentAlarmParam; import cn.stylefeng.guns.modular.em.equipmentAlarm.service.EquipmentAlarmService; import cn.stylefeng.roses.core.base.controller.BaseController; import cn.stylefeng.roses.kernel.model.response.ResponseData; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 设备报警控制器 * * @author cl * @Date 2022-10-28 15:52:30 */ @Controller @RequestMapping("/equipmentAlarm") public class EquipmentAlarmController extends BaseController { private String PREFIX = "modular/em/equipmentAlarm"; @Autowired private EquipmentAlarmService equipmentAlarmService; /** * 跳转到主页面 * * @author cl * @Date 2022-10-28 */ @RequestMapping("") public String index() { return PREFIX + "/equipmentAlarm.html"; } /** * 新增页面 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/add") public String add() { return PREFIX + "/equipmentAlarm_add.html"; } /** * 编辑页面 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/edit") public String edit() { return PREFIX + "/equipmentAlarm_edit.html"; } /** * 新增接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/addItem") @ResponseBody public ResponseData addItem(EquipmentAlarmParam equipmentAlarmParam) { this.equipmentAlarmService.add(equipmentAlarmParam); return ResponseData.success(); } /** * 编辑接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/editItem") @ResponseBody public ResponseData editItem(EquipmentAlarmParam equipmentAlarmParam) { this.equipmentAlarmService.update(equipmentAlarmParam); return ResponseData.success(); } /** * 删除接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/delete") @ResponseBody public ResponseData delete(EquipmentAlarmParam equipmentAlarmParam) { this.equipmentAlarmService.delete(equipmentAlarmParam); return ResponseData.success(); } /** * 查看详情接口 * * @author cl * @Date 2022-10-28 */ @RequestMapping("/detail") @ResponseBody public ResponseData detail(EquipmentAlarmParam equipmentAlarmParam) { EquipmentAlarm detail = this.equipmentAlarmService.getById(equipmentAlarmParam.getId()); return ResponseData.success(detail); } /** * 查询列表 * * @author cl * @Date 2022-10-28 */ @ResponseBody @RequestMapping("/list") public LayuiPageInfo list(EquipmentAlarmParam equipmentAlarmParam) { return this.equipmentAlarmService.findPageBySpec(equipmentAlarmParam); } @ResponseBody @CrossOrigin @RequestMapping("/bigList") public List bigList() { List arrayList = new ArrayList(); List alarmTime = equipmentAlarmService.list(new QueryWrapper().orderByDesc("alarm_time")); for (int i = 0; i < 10; i++) { // List resultList = new ArrayList(); // resultList.add(alarmTime.get(i).getWorkshopCode()); // resultList.add(alarmTime.get(i).getEquipmentNo()); // resultList.add(alarmTime.get(i).getLocationCode()); // arrayList.add(resultList); List resultList = new ArrayList(); // resultList.add(alarmTime.get(i).getEquipmentNo()); resultList.add(alarmTime.get(i).getLocationCode()); resultList.add(alarmTime.get(i).getAlarmTime()); arrayList.add(resultList); } return arrayList; } }