From af97e376db85a53b41c9fe069bd2948b59387e49 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期二, 05 十一月 2024 16:28:38 +0800
Subject: [PATCH] 优化工况管理右侧树形结构显示的后端处理速度

---
 modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
index 572c271..12b4d14 100644
--- a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -79,9 +79,11 @@
         SET repair_mttcr = 0
         where b.ship_id = ${shipId}
           and repair_mttcr is null;
+
         UPDATE param_data a, product_model b
         SET basic_mtbf_regulate_tmp = basic_mtbf_regulate
         where b.ship_id = ${shipId};
+
         UPDATE param_data a, product_model b
         SET basic_mtbf_regulate_tmp = basic_runs_num / basic_mtbf_regul_succ_rate
         where b.ship_id = ${shipId}
@@ -92,12 +94,29 @@
         UPDATE param_data a, product_model b
         SET basic_mtbf_regulate = basic_mtbf_regulate_tmp
         where b.ship_id = ${shipId}
-          and (reliab_distrib_type = 1 or reliab_distrib_type is null);
+          and (reliab_distrib_type = 1 or reliab_distrib_type is null)
+          and a.product_id = b.id
+          and a.IS_DELETE = 0
+          and b.IS_DELETE = 0;
 
         UPDATE param_data a, product_model b
         SET ai = basic_mtbf_regulate_tmp / (basic_mtbf_regulate_tmp + repair_mttcr)
         where b.ship_id = ${shipId}
+          and a.product_id = b.id
+          and a.IS_DELETE = 0
+          and b.IS_DELETE = 0;
 
+        UPDATE param_data a,(
+            select pid, case when count(1) > 0 then 1 else 0 end as basic_join_compute
+            from param_data a,
+                 product_model b
+            where b.ship_id = ${shipId}
+              and a.product_id = b.id
+              and a.basic_join_compute = 1
+            group by b.pid
+        ) b
+        set a.basic_join_compute = b.basic_join_compute
+        where a.product_id = b.pid;
     </update>
 
     <select id="getAI" resultType="com.zt.life.modules.mainPart.basicInfo.model.ParamData">
@@ -109,11 +128,13 @@
                b.repair_mttcr,
                b.basic_mtbf_operating_ratio,
                b.basic_mtbf_regul_succ_rate,
-               b.basic_runs_num
+               b.basic_runs_num,
+               b.basic_unit_num
         FROM product_model a
                  LEFT JOIN param_data b ON b.product_id = a.id and b.is_delete = 0
         where a.is_delete = 0
             and a.product_type &lt;&gt; 10
+            and b.basic_join_compute = 1
             and a.ship_id = ${shipId}
            or a.id = ${shipId}
         ORDER BY a.product_type, a.sort

--
Gitblit v1.9.1