From 21caf8ad8e7d24c3bbf7cf4a90c35f51851fd6cb Mon Sep 17 00:00:00 2001
From: lius <Lius2225@163.com>
Date: 星期一, 21 八月 2023 16:57:25 +0800
Subject: [PATCH] 设备权限接口更新

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java |   44 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
index 1307c01..6214b1d 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -10,6 +10,8 @@
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.mdc.dto.EquipmentTemperatureDto;
+import org.jeecg.modules.mdc.dto.MdcEquDepDto;
+import org.jeecg.modules.mdc.dto.MdcEquProDto;
 import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
 import org.jeecg.modules.mdc.entity.*;
 import org.jeecg.modules.mdc.mapper.MdcEquipmentMapper;
@@ -467,6 +469,9 @@
             }
         }
         //鏍规嵁浜х嚎闆嗗悎鏌ユ壘鎵�鏈夎澶噄d
+        if (allDepartIds.isEmpty()) {
+            return null;
+        }
         List<String> equipmentIds = this.baseMapper.queryIdsByDeparts(allDepartIds);
         if (StringUtils.isNotEmpty(key)) {
             //key涓嶄负绌猴紝鏌ヨ鎵�鏈変笅绾ч儴闂╥d
@@ -513,6 +518,9 @@
             }
         }
         //鏍规嵁浜х嚎闆嗗悎鏌ユ壘鎵�鏈夎澶噄d
+        if (allProductionIds.isEmpty()) {
+            return null;
+        }
         List<String> equipmentIds = this.baseMapper.queryIdsByProductions(allProductionIds);
         if (StringUtils.isNotEmpty(key)) {
             //key涓嶄负绌猴紝鏌ヨ鎵�鏈変笅绾т骇绾縤d
@@ -634,7 +642,7 @@
     }
 
     /**
-     *  鏍规嵁浜х嚎灞傜骇鏌ヨ璁惧鍗曚釜
+     * 鏍规嵁浜х嚎灞傜骇鏌ヨ璁惧鍗曚釜
      */
     @Override
     public MdcEquipment getEquipmentByPid(String pid, String userId) {
@@ -645,4 +653,38 @@
         return null;
     }
 
+    /**
+     * 鏍规嵁璁惧缂栧彿鏌ヨ璁惧淇℃伅鍜岄儴闂ㄤ俊鎭�
+     *
+     * @param equipmentIdList
+     * @return
+     */
+    @Override
+    public List<MdcEquDepDto> findEquDepList(List<String> equipmentIdList) {
+        return this.baseMapper.findEquDepList(equipmentIdList);
+    }
+
+    /**
+     * 鏍规嵁璁惧缂栧彿鏌ヨ璁惧淇℃伅鍜屼骇绾夸俊鎭�
+     *
+     * @param equipmentIdList
+     * @return
+     */
+    @Override
+    public List<MdcEquProDto> findEquProList(List<String> equipmentIdList) {
+        return this.baseMapper.findEquProList(equipmentIdList);
+    }
+
+    /**
+     * 鏍规嵁閮ㄩ棬灞傜骇鏌ヨ璁惧鍗曚釜
+     */
+    @Override
+    public MdcEquipment getEquipmentByDepPid(String pid, String userId) {
+        List<String> idsByDepart = this.getEquipmentIdsByDepart(userId, pid);
+        if (idsByDepart != null && !idsByDepart.isEmpty()) {
+            return super.getOne(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, idsByDepart.get(0)));
+        }
+        return null;
+    }
+
 }

--
Gitblit v1.9.3