From 901bab9b8b1c3773a644bdc74f5eafd666591aeb Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 17 九月 2026 13:37:24 +0800
Subject: [PATCH] feat: 1委托单 2下单详情 3检验任务 4检验任务复核 5检验任务详情 6标准维护 7检验单详情 8报告编制

---
 basic-server/src/main/resources/mapper/StandardTreeMapper.xml |  156 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 139 insertions(+), 17 deletions(-)

diff --git a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
index ae8c4d5..f13da93 100644
--- a/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -10,6 +10,8 @@
         <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
         <result property="sample" column="sample" jdbcType="VARCHAR"/>
         <result property="model" column="model" jdbcType="VARCHAR"/>
+        <result property="sort" column="sort" jdbcType="INTEGER"/>
+        <result property="standardMethodId" column="standard_method_id" jdbcType="INTEGER"/>
         <result property="createUser" column="create_user" jdbcType="INTEGER"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
@@ -89,24 +91,106 @@
         rates
     </sql>
 
-    <select id="selectStandardTreeList" resultMap="FactoryDto">
-        select ''                          factory,
-               l.laboratory_name laboratory,
-               sto.specimen_name sample_type,
-               p.name            sample,
-               st.model,
-               sto.code,
-               sto.id  sample_type_id,
-               sto.sort,
-               sto.specimen_name_en sample_type_en,
-               p.name_en sample_en
-        from laboratory l
-                 left join structure_test_object sto on sto.laboratory_id = l.id
-                 left join product p on p.object_id = sto.id
-                 left join standard_tree st on st.sample_type = sto.specimen_name
-            and st.sample = p.name
-        order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id
+    <select id="selectStandardLibraryTree" resultType="com.ruoyi.basic.dto.StandardLibraryTreeRowDto">
+        SELECT l.id                                      AS industry_id,
+               l.laboratory_name                         AS industry_name,
+               l.sort                                    AS industry_sort,
+               st.id                                     AS standard_id,
+               sm.id                                     AS standard_method_id,
+               sm.code                                   AS standard_code,
+               sm.name                                   AS standard_name,
+               sm.name_en                                AS standard_name_en,
+               CONCAT(sm.code, ' - ', sm.name)           AS standard_label,
+               st.sort                                   AS standard_sort
+        FROM laboratory l
+        LEFT JOIN standard_tree st
+               ON st.laboratory = l.laboratory_name
+              AND st.sample_type IS NULL
+              AND st.model IS NULL
+              AND st.standard_method_id IS NOT NULL
+              AND EXISTS (SELECT 1 FROM standard_method sm0
+                          WHERE sm0.id = st.standard_method_id
+                            AND sm0.is_product = 1 AND sm0.is_use = 1)
+        LEFT JOIN standard_method sm ON sm.id = st.standard_method_id
+        ORDER BY COALESCE(l.sort, 0), l.id,
+                 COALESCE(st.sort, 0), st.id
     </select>
+
+    <update id="updateProductListIndustry">
+        UPDATE standard_product_list
+        SET laboratory = #{newName},
+            tree = CASE WHEN sample_type IS NULL AND model IS NULL AND sample IS NOT NULL
+                        THEN CONCAT(#{newName}, ' - null - ', sample)
+                        ELSE tree END
+        WHERE laboratory = #{oldName}
+    </update>
+
+    <update id="updateProductListStandard">
+        UPDATE standard_product_list
+        SET sample = #{newName},
+            tree = CONCAT(#{industry}, ' - null - ', #{newName})
+        WHERE laboratory = #{industry}
+          AND sample = #{oldName}
+          AND sample_type IS NULL
+          AND model IS NULL
+    </update>
+
+    <update id="updateInsOrderIndustry">
+        UPDATE ins_order
+        SET laboratory = #{newName}
+        WHERE laboratory = #{oldName}
+          AND (state IS NULL OR state NOT IN (3, -1))
+          AND (ins_state IS NULL OR ins_state != 5)
+    </update>
+
+    <update id="updateInsSampleIndustry">
+        UPDATE ins_sample s
+        JOIN ins_order o ON o.id = s.ins_order_id
+        SET s.laboratory = #{newName}
+        WHERE s.laboratory = #{oldName}
+          AND (o.state IS NULL OR o.state NOT IN (3, -1))
+          AND (o.ins_state IS NULL OR o.ins_state != 5)
+    </update>
+
+    <update id="updateInsProductIndustry">
+        UPDATE ins_product p
+        JOIN ins_sample s ON s.id = p.ins_sample_id
+        JOIN ins_order o ON o.id = s.ins_order_id
+        SET p.laboratory = #{newName}
+        WHERE p.laboratory = #{oldName}
+          AND (o.state IS NULL OR o.state NOT IN (3, -1))
+          AND (o.ins_state IS NULL OR o.ins_state != 5)
+    </update>
+
+    <update id="updateInsOrderStandard">
+        UPDATE ins_order
+        SET sample = #{newName}
+        WHERE laboratory = #{industry}
+          AND sample = #{oldName}
+          AND (state IS NULL OR state NOT IN (3, -1))
+          AND (ins_state IS NULL OR ins_state != 5)
+    </update>
+
+    <update id="updateInsSampleStandard">
+        UPDATE ins_sample s
+        JOIN ins_order o ON o.id = s.ins_order_id
+        SET s.sample = #{newName}
+        WHERE s.laboratory = #{industry}
+          AND s.sample = #{oldName}
+          AND (o.state IS NULL OR o.state NOT IN (3, -1))
+          AND (o.ins_state IS NULL OR o.ins_state != 5)
+    </update>
+
+    <update id="updateInsProductStandard">
+        UPDATE ins_product p
+        JOIN ins_sample s ON s.id = p.ins_sample_id
+        JOIN ins_order o ON o.id = s.ins_order_id
+        SET p.sample = #{newName}
+        WHERE p.laboratory = #{industry}
+          AND p.sample = #{oldName}
+          AND (o.state IS NULL OR o.state NOT IN (3, -1))
+          AND (o.ins_state IS NULL OR o.ins_state != 5)
+    </update>
 
     <select id="selectStandardProductById" resultType="com.ruoyi.basic.pojo.StandardProductList">
         select inspection_item,
@@ -194,6 +278,44 @@
         order by inspection_item_class, inspection_item, id asc
     </select>
 
+    <select id="selectStandardProductListByIndustry" resultType="com.ruoyi.basic.pojo.StandardProductList">
+        select inspection_item,
+               inspection_item_en,
+               inspection_item_subclass,
+               inspection_item_subclass_en,
+               inspection_item_class,
+               inspection_item_class_en,
+               method,
+               son_laboratory,
+               unit,
+               ask_tell as tell,
+               ask,
+               price,
+               man_hour,
+               man_hour_group,
+               man_day,
+               inspection_item_type,
+               inspection_value_type,
+               bsm,
+               template_id,
+               laboratory,
+               checkout_number,
+               section,
+               dic,
+               0 as state,
+               null as model,
+               #{standard} as sample,
+               #{tree} as tree,
+               id as structure_item_parameter_id,
+               radius_list,
+               rates
+        from structure_item_parameter
+        where (laboratory is null
+            or laboratory = ''
+            or laboratory = #{industry})
+        order by inspection_item_class, inspection_item, id asc
+    </select>
+
     <select id="getStandardTree2" resultMap="SampleTypeDto">
         select sto.specimen_name sample_type,
                p.name            sample,

--
Gitblit v1.9.3