From 92c572e50893a93a810bbe6adb6d3cdbfc225073 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 20 五月 2025 14:17:33 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/controller/DeviceErrorController.java | 47 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/DeviceErrorController.java b/src/main/java/com/zy/asrs/controller/DeviceErrorController.java
index 54b03a2..fbd9636 100644
--- a/src/main/java/com/zy/asrs/controller/DeviceErrorController.java
+++ b/src/main/java/com/zy/asrs/controller/DeviceErrorController.java
@@ -1,6 +1,5 @@
package com.zy.asrs.controller;
-import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -13,11 +12,13 @@
import com.core.common.Cools;
import com.core.common.R;
import com.zy.common.web.BaseController;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
+@Slf4j
@RestController
public class DeviceErrorController extends BaseController {
@@ -30,6 +31,20 @@
return R.ok(deviceErrorService.selectById(String.valueOf(id)));
}
+// @RequestMapping(value = "/deviceError/list/auth")
+// @ManagerAuth
+// public R list(@RequestParam(defaultValue = "1")Integer curr,
+// @RequestParam(defaultValue = "10")Integer limit,
+// @RequestParam(required = false)String orderByField,
+// @RequestParam(required = false)String orderByType,
+// @RequestParam Map<String, Object> param){
+// EntityWrapper<DeviceError> wrapper = new EntityWrapper<>();
+// excludeTrash(param);
+// convert(param, wrapper);
+// if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+// return R.ok(deviceErrorService.selectPage(new Page<>(curr, limit), wrapper));
+// }
+
@RequestMapping(value = "/deviceError/list/auth")
@ManagerAuth
public R list(@RequestParam(defaultValue = "1")Integer curr,
@@ -37,11 +52,31 @@
@RequestParam(required = false)String orderByField,
@RequestParam(required = false)String orderByType,
@RequestParam Map<String, Object> param){
- EntityWrapper<DeviceError> wrapper = new EntityWrapper<>();
- excludeTrash(param);
- convert(param, wrapper);
- if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
- return R.ok(deviceErrorService.selectPage(new Page<>(curr, limit), wrapper));
+ try {
+ long id = 0;
+ String device = null;
+ Integer deviceId = null;
+ for (Map.Entry<String, Object> entry : param.entrySet()) {
+ String val = String.valueOf(entry.getValue());
+ if (Cools.isEmpty(val)) {
+ continue;
+ }
+ if (entry.getKey().equals("id")) {
+ id = (long) Integer.parseInt(val);
+ } else if (entry.getKey().equals("device")) {
+ device = val;
+ } else if (entry.getKey().equals("device_id")) {
+ deviceId = Integer.valueOf(val);
+ }
+ }
+ List<DeviceError> deviceErrorList = deviceErrorService.selectDeviceErrorList(id,device,deviceId, curr, limit);
+ Page<DeviceError> page1 = new Page<DeviceError>(curr, limit).setRecords(deviceErrorList);
+ page1.setTotal(deviceErrorService.selectDeviceErrorListTotal(id,device,deviceId));
+ return R.ok(page1);
+ } catch (Exception e) {
+ log.error("寮傚父" + e);
+ return R.error("寮傚父" + e);
+ }
}
private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
--
Gitblit v1.9.1