From 2cf1565485060fd56e1f1f1cffbba7a4d70d42a6 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期五, 11 四月 2025 11:06:22 +0800
Subject: [PATCH] 优化dnc,设备结构树查询,优化原有代码

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java
index 1722137..a99a09a 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceInfoController.java
@@ -3,13 +3,15 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
-import org.jeecg.modules.dnc.response.*;
-import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.dnc.entity.DeviceInfo;
+import org.jeecg.modules.dnc.response.*;
 import org.jeecg.modules.dnc.service.IDeviceInfoService;
-import org.jeecg.modules.dnc.ucenter.UserDepartExt;
+import org.jeecg.modules.dnc.service.IDevicePermissionService;
+import org.jeecg.modules.mdc.model.MdcEquipmentTree;
+import org.jeecg.modules.system.entity.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -23,6 +25,8 @@
 public class DeviceInfoController extends JeecgController<DeviceInfo, IDeviceInfoService> {
     @Autowired
     private IDeviceInfoService deviceInfoService;
+    @Autowired
+    private IDevicePermissionService devicePermissionService;
 
     @AutoLog(value = "璁惧琛�-鏂板璁惧")
     @ApiOperation(value = "璁惧琛�-鏂板璁惧", notes = "璁惧琛�-鏂板璁惧")
@@ -70,8 +74,8 @@
     @AutoLog(value = "璁惧琛�-鑾峰彇鑺傜偣宸插垎閰嶇殑鐢ㄦ埛")
     @ApiOperation(value = "璁惧琛�-鑾峰彇鑺傜偣宸插垎閰嶇殑鐢ㄦ埛", notes = "璁惧琛�-鑾峰彇鑺傜偣宸插垎閰嶇殑鐢ㄦ埛")
     @GetMapping("/get/perm/user/{nodeType}/{paramId}")
-    public QueryListResponseResult<UserDepartExt> getUserPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) {
-        List<UserDepartExt> list = deviceInfoService.getUserPermsList(nodeType, paramId);
+    public QueryListResponseResult<SysUser> getUserPermsList(@PathVariable("nodeType") Integer nodeType, @PathVariable("paramId") String paramId) {
+        List<SysUser> list = deviceInfoService.getUserPermsList(nodeType, paramId);
         if(list == null)
             list = Collections.emptyList();
         return new QueryListResponseResult(CommonCode.SUCCESS, list);
@@ -156,4 +160,22 @@
         }
         return new ResponseResult(CommonCode.SUCCESS);
     }
+
+    /**
+     * 鍔犺浇浜х嚎璁惧鏍�
+     */
+    @AutoLog(value = "璁惧琛�-鍔犺浇浜х嚎璁惧鏍�")
+    @ApiOperation(value = "璁惧琛�-鍔犺浇浜х嚎璁惧鏍�", notes = "璁惧琛�-鍔犺浇浜х嚎璁惧鏍�")
+    @GetMapping(value = "/queryTreeListByProduction")
+    public Result<List<MdcEquipmentTree>> queryTreeListByProduction() {
+        Result<List<MdcEquipmentTree>> result = new Result<>();
+        try {
+            List<MdcEquipmentTree> mdcEquipmentTreeList = devicePermissionService.DncLoadTreeListByProduction();
+            result.setSuccess(true);
+            result.setResult(mdcEquipmentTreeList);
+        } catch (Exception e) {
+            return Result.error("鍔犺浇浜х嚎璁惧鏍戝け璐ワ紒" + e.getMessage());
+        }
+        return result;
+    }
 }

--
Gitblit v1.9.3