From cd7b35b1acc7467deac78ba843b5870a22c9c7f6 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期二, 06 八月 2024 08:59:12 +0800
Subject: [PATCH] 修改

---
 modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml |  131 +++++++++++++++++++++++--------------------
 1 files changed, 69 insertions(+), 62 deletions(-)

diff --git a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
index 286fedf..d35bb9e 100644
--- a/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/baseReliability/ParamDataBasicDao.xml
@@ -4,72 +4,78 @@
 <mapper namespace="com.zt.life.modules.mainPart.baseReliability.dao.ParamDataBasicDao">
     <update id="compute">
         update param_data f,
-        (
-        SELECT
-        c.*,
-        CASE
-        WHEN WeightedFailure IS NOT NULL
-        AND WeightedFailure > 0 THEN
-        1 / WeightedFailure ELSE 0
-        END AS basic_mtbf_regulate,
-        CASE
-        WHEN WeightedFailure IS NOT NULL
-        AND WeightedFailure > 0 THEN
-        WeightedMTTR / WeightedFailure ELSE 0
-        END AS repair_mttcr
-        FROM
-        (
-        SELECT
-        c.id,
-        c.name,
-        sum(
-        CASE
-        WHEN b.product_type &lt; 5 THEN
-        1 * 1 / basic_mtbf_regulate
-        WHEN a.reliab_distrib_type = 1 THEN
-        1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate
-        WHEN a.reliab_distrib_type = 2 THEN
-        1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regul_succ_rate
-        ELSE 0 END
-        ) AS WeightedFailure,
-        sum(
-        CASE
-        WHEN b.product_type &lt; 5 THEN
-        1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate
-        WHEN a.repairable = 1 and a.reliab_distrib_type = 1 THEN
-        1 * a.basic_mtbf_operating_ratio * a.repair_mttcr / a.basic_mtbf_regulate
-        WHEN a.repairable = 1 and a.reliab_distrib_type = 2 THEN
-        1 * a.basic_mtbf_operating_ratio * a.repair_mttcr / a.basic_mtbf_regul_succ_rate
-        ELSE 0
-        END
-        ) AS WeightedMttr
-        FROM
-        param_data a,
-        product_model b,
-        product_model c
-        WHERE 1 = 1
-        and c.ship_id = ${shipId} and c.product_type = ${productType} and c.is_delete = 0
-        and b.ship_id = ${shipId} and b.pid = c.id and b.is_delete = 0
-        and a.IS_DELETE = 0 and a.product_id = b.id
-        AND ( (b.product_type = 5 AND a.basic_join_compute = 1
-        and ((
-        a.reliab_distrib_type = 1
-        AND a.basic_mtbf_regulate > 0
-        )
-        OR ( a.reliab_distrib_type = 2 AND a.basic_mtbf_regul_succ_rate > 0 ))
-        )
-        || (b.product_type &lt; 5 AND a.basic_mtbf_regulate > 0 ) )
-        GROUP BY c.id,c.name
-        ) c
-        )d set f.basic_mtbf_regulate = d.basic_mtbf_regulate,
-        f.repair_mttcr = d.repair_mttcr
+            (
+                SELECT c.*,
+                       CASE
+                           WHEN WeightedFailure IS NOT NULL
+                               AND WeightedFailure > 0 THEN
+                               1 / WeightedFailure
+                           ELSE 0
+                           END AS basic_mtbf_regulate,
+                       CASE
+                           WHEN WeightedFailure IS NOT NULL
+                               AND WeightedFailure > 0 THEN
+                               WeightedMTTR / WeightedFailure
+                           ELSE 0
+                           END AS repair_mttcr
+                FROM (
+                         SELECT c.id,
+                                c.name,
+                                sum(
+                                        CASE
+                                            WHEN b.product_type &lt; 5 THEN
+                                                1 * 1 / basic_mtbf_regulate
+                                            WHEN a.reliab_distrib_type = 1 THEN
+                                                1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regulate
+                                            WHEN a.reliab_distrib_type = 2 THEN
+                                                1 * a.basic_mtbf_operating_ratio / a.basic_mtbf_regul_succ_rate
+                                            ELSE 0 END
+                                    ) AS WeightedFailure,
+                                sum(
+                                        CASE
+                                            WHEN b.product_type &lt; 5 THEN
+                                                1 * 1 * a.repair_mttcr / a.basic_mtbf_regulate
+                                            WHEN a.repairable = 1 and a.reliab_distrib_type = 1 THEN
+                                                    1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+                                                    a.basic_mtbf_regulate
+                                            WHEN a.repairable = 1 and a.reliab_distrib_type = 2 THEN
+                                                    1 * a.basic_mtbf_operating_ratio * a.repair_mttcr /
+                                                    a.basic_mtbf_regul_succ_rate
+                                            ELSE 0
+                                            END
+                                    ) AS WeightedMttr
+                         FROM param_data a,
+                              product_model b,
+                              product_model c
+                         WHERE 1 = 1
+                           and c.ship_id = ${shipId}
+                           and c.product_type = ${productType}
+                           and c.is_delete = 0
+                           and b.ship_id = ${shipId}
+                           and b.pid = c.id
+                           and b.is_delete = 0
+                           and a.IS_DELETE = 0
+                           and a.product_id = b.id
+                           AND ((b.product_type = 5 AND a.basic_join_compute = 1
+                             and ((
+                                          a.reliab_distrib_type = 1
+                                          AND a.basic_mtbf_regulate > 0
+                                      )
+                                 OR (a.reliab_distrib_type = 2 AND a.basic_mtbf_regul_succ_rate > 0))
+                                    )
+                             || (b.product_type &lt; 5 AND a.basic_mtbf_regulate > 0))
+                         GROUP BY c.id, c.name
+                     ) c
+            ) d
+        set f.basic_mtbf_regulate = d.basic_mtbf_regulate,
+            f.repair_mttcr        = d.repair_mttcr
         where f.product_id = d.id;
     </update>
 
     <update id="compute2">
         UPDATE param_data a, product_model b
         SET ai = basic_mtbf_regulate / (basic_mtbf_regulate + repair_mttcr)
-        where  b.ship_id = ${shipId}
+        where b.ship_id = ${shipId}
     </update>
 
     <select id="getAI" resultType="com.zt.life.modules.mainPart.basicInfo.model.ParamData">
@@ -83,8 +89,9 @@
         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.ship_id = ${shipId}
-           or a.id =${shipId}
+            and a.product_type &lt;&gt; 10
+            and a.ship_id = ${shipId}
+           or a.id = ${shipId}
         ORDER BY a.product_type, a.sort
     </select>
 

--
Gitblit v1.9.1