From 15a20a91316b726f45ccc9e06bbd632f10eedb43 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期五, 13 九月 2024 14:10:55 +0800
Subject: [PATCH] update

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml         |   12 +++++++++---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java    |    8 ++++----
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java |   23 ++++++++++++-----------
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java            |    6 ++++--
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java         |    4 ++--
 5 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
index d1c20c4..612a87e 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -385,12 +385,12 @@
     @AutoLog(value = "璁惧琛�-鍔犺浇閮ㄩ棬璁惧鏍�")
     @ApiOperation(value = "璁惧琛�-鍔犺浇閮ㄩ棬璁惧鏍�", notes = "璁惧琛�-鍔犺浇閮ㄩ棬璁惧鏍�")
     @GetMapping(value = "/queryTreeListByDepart")
-    public Result<List<MdcEquipmentTree>> queryTreeListByDepart() {
+    public Result<List<MdcEquipmentTree>> queryTreeListByDepart(@RequestParam(name = "key", required = false) String key) {
         Result<List<MdcEquipmentTree>> result = new Result<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
         try {
-            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByDepart(userId);
+            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByDepart(userId, key);
             result.setSuccess(true);
             result.setResult(mdcEquipmentTreeList);
         } catch (Exception e) {
@@ -405,12 +405,12 @@
     @AutoLog(value = "璁惧琛�-鍔犺浇浜х嚎璁惧鏍�")
     @ApiOperation(value = "璁惧琛�-鍔犺浇浜х嚎璁惧鏍�", notes = "璁惧琛�-鍔犺浇浜х嚎璁惧鏍�")
     @GetMapping(value = "/queryTreeListByProduction")
-    public Result<List<MdcEquipmentTree>> queryTreeListByProduction() {
+    public Result<List<MdcEquipmentTree>> queryTreeListByProduction(@RequestParam(name = "key", required = false) String key) {
         Result<List<MdcEquipmentTree>> result = new Result<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
         try {
-            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId);
+            List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId, key);
             result.setSuccess(true);
             result.setResult(mdcEquipmentTreeList);
         } catch (Exception e) {
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
index 80991e7..4825207 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -50,12 +50,12 @@
     /**
      * 鏍规嵁閮ㄩ棬id鏌ヨ璁惧
      */
-    List<MdcEquipment> queryByDepartId(@Param("departId") String departId);
+    List<MdcEquipment> queryByDepartId(@Param("departId") String departId, @Param("key") String key);
 
     /**
      * 鏍规嵁浜х嚎id鏌ヨ璁惧
      */
-    List<MdcEquipment> queryByProductionId(@Param("productionId") String productionId);
+    List<MdcEquipment> queryByProductionId(@Param("productionId") String productionId, @Param("key") String key);
 
     /**
      * 鏌ユ壘璁惧鐩戞帶淇℃伅
@@ -104,6 +104,7 @@
 
     /**
      * 瀵煎嚭list
+     *
      * @param mdcEquipment
      * @return
      */
@@ -111,6 +112,7 @@
 
     /**
      * 鏌ヨ鍗曡〃鏁版嵁
+     *
      * @param tableName
      * @return
      */
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
index d8a0819..925e610 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -58,6 +58,9 @@
         WHERE
             med.equipment_id = me.id
             AND med.dep_id = #{ departId }
+            <if test="key != null and key != '' ">
+                AND me.device_abnormal_status = 1
+            </if>
         ORDER BY me.equipment_id
     </select>
 
@@ -71,6 +74,9 @@
         WHERE
             mpe.equipment_id = me.id
             AND mpe.production_id = #{ productionId }
+          <if test="key != null and key != '' ">
+              AND me.device_abnormal_status = 1
+          </if>
         ORDER BY me.equipment_id
     </select>
 
@@ -83,9 +89,9 @@
             LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
         WHERE
             mpe.production_id IN
-        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
-            #{id}
-        </foreach>
+            <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
     </select>
 
     <!--鏌ヨ璁惧鐩戞帶淇℃伅-->
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
index 1edd84c..ca91607 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -101,12 +101,12 @@
     /**
      * 鍔犺浇閮ㄩ棬璁惧鏍�
      */
-    List<MdcEquipmentTree> loadTreeListByDepart(String userId);
+    List<MdcEquipmentTree> loadTreeListByDepart(String userId, String key);
 
     /**
      * 鍔犺浇浜х嚎璁惧鏍�
      */
-    List<MdcEquipmentTree> loadTreeListByProduction(String userId);
+    List<MdcEquipmentTree> loadTreeListByProduction(String userId, String key);
 
     /**
      * 璁惧鐩戞帶鍒楄〃
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 5e141e1..bc8cac9 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
@@ -227,7 +227,7 @@
     }
 
     @Override
-    public List<MdcEquipmentTree> loadTreeListByDepart(String userId) {
+    public List<MdcEquipmentTree> loadTreeListByDepart(String userId, String key) {
         //鑾峰彇鎵�鏈夐儴闂ㄦ暟鎹�
         List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(SysDepart::getDepartOrder));
         //鏍规嵁鐢ㄦ埛ID鑾峰彇鎷ユ湁鐨勯儴闂╥d闆嗗悎
@@ -244,7 +244,7 @@
         //缁勮閮ㄩ棬璁惧鏍�
         List<MdcEquipmentTree> treeList = FindsEquipmentDepartUtil.wrapEquipmentDepartTreeList(list);
         //濉厖璁惧鏁版嵁
-        FillEquipmentByDepart(treeList);
+        FillEquipmentByDepart(treeList, key);
         return treeList;
     }
 
@@ -253,9 +253,9 @@
      *
      * @param treeList
      */
-    private void FillEquipmentByDepart(List<MdcEquipmentTree> treeList) {
+    private void FillEquipmentByDepart(List<MdcEquipmentTree> treeList, String key) {
         for (MdcEquipmentTree mdcEquipmentTree : treeList) {
-            List<MdcEquipment> equipmentList = this.baseMapper.queryByDepartId(mdcEquipmentTree.getKey());
+            List<MdcEquipment> equipmentList = this.baseMapper.queryByDepartId(mdcEquipmentTree.getKey(), key);
             if (equipmentList != null && !equipmentList.isEmpty()) {
                 for (MdcEquipment mdcEquipment : equipmentList) {
                     MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment);
@@ -265,7 +265,7 @@
                 mdcEquipmentTree.setLeaf(false);
             }
             if (!mdcEquipmentTree.getChildren().isEmpty()) {
-                FillEquipmentByDepart(mdcEquipmentTree.getChildren());
+                FillEquipmentByDepart(mdcEquipmentTree.getChildren(), key);
             }
         }
     }
@@ -292,7 +292,7 @@
 
 
     @Override
-    public List<MdcEquipmentTree> loadTreeListByProduction(String userId) {
+    public List<MdcEquipmentTree> loadTreeListByProduction(String userId, String key) {
         //鑾峰彇鎵�鏈変骇绾挎暟鎹�
         List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder));
         //鏍规嵁鐢ㄦ埛id鑾峰彇鎷ユ湁鐨勪骇绾夸俊鎭泦鍚�
@@ -309,7 +309,7 @@
         //缁勮浜х嚎璁惧鏍�
         List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
         //濉厖璁惧鏁版嵁
-        FillEquipmentByProduction(treeList);
+        FillEquipmentByProduction(treeList, key);
         return treeList;
     }
 
@@ -632,9 +632,9 @@
     /**
      * 浜х嚎璁惧鏍戝~鍏呰澶囨暟鎹�
      */
-    private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList) {
+    private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList, String key) {
         for (MdcEquipmentTree mdcEquipmentTree : treeList) {
-            List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey());
+            List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey(), key);
             if (equipmentList != null && !equipmentList.isEmpty()) {
                 for (MdcEquipment mdcEquipment : equipmentList) {
                     MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment);
@@ -644,7 +644,7 @@
                 mdcEquipmentTree.setLeaf(false);
             }
             if (!mdcEquipmentTree.getChildren().isEmpty()) {
-                FillEquipmentByProduction(mdcEquipmentTree.getChildren());
+                FillEquipmentByProduction(mdcEquipmentTree.getChildren(), key);
             }
         }
     }
@@ -855,12 +855,13 @@
         //缁勮浜х嚎璁惧鏍�
         List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list);
         //濉厖璁惧鏁版嵁
-        FillEquipmentByProduction(treeList);
+        FillEquipmentByProduction(treeList, null);
         return treeList;
     }
 
     /**
      * 鏌ヨ鍗曡〃鏁版嵁
+     *
      * @param tableName
      * @return
      */

--
Gitblit v1.9.3