From 95e69381eeb4a589e9ab7b8e3b967ceb36d13b1d Mon Sep 17 00:00:00 2001
From: Crunchy <3114200645@qq.com>
Date: 星期四, 18 七月 2024 18:20:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 inspect-server/src/main/resources/mapper/InsOrderMapper.xml |   78 ++++++++++++++++++++++----------------
 1 files changed, 45 insertions(+), 33 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
index 853eb28..a0b49ae 100644
--- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -56,6 +56,42 @@
         <association property="children" resultMap="SampleDefectsChildrenMap" javaType="java.util.List"/>
     </resultMap>
 
+    <select id="selectInsOrderPage" resultType="com.yuanchu.mom.dto.SampleOrderDto">
+        select *
+        from (
+        SELECT
+        io.*,
+        ir.id report_id,
+        ir.url,
+        ir.url_s,
+        (select count(*) from ins_sample isa2
+        where isa2.ins_order_id = io.id and isa2.sample_code NOT REGEXP '/') sample_num,
+        concat(ROUND((select count(*) from ins_product ip
+        where state = 1 and ins_result is not null and ip.ins_sample_id in (select id from ins_sample where
+        ins_sample.ins_order_id= io.id )) / (select count(*) from ins_product ip2
+        where state = 1 and ip2.ins_sample_id in (select id from ins_sample where ins_sample.ins_order_id= io.id )) *
+        100, 2), '%') insProgress,
+        group_concat(distinct isa.sample_code,' ') sample_code,
+        group_concat(distinct isa.sample,' ') sample_name,
+        group_concat(distinct isa.model,' ') sample_model,
+        u.name
+        FROM
+        ins_order io
+        LEFT JOIN ins_sample isa ON io.id = isa.ins_order_id
+        LEFT JOIN ( SELECT id, ins_order_id, is_ratify, url,url_s FROM ins_report WHERE is_ratify = 1 ) ir ON io.id =
+        ir.ins_order_id
+        left join user u on io.create_user = u.id
+        where 1=1
+        <if test="laboratory!=null and laboratory!=''">
+            and io.laboratory=#{laboratory}
+        </if>
+        GROUP BY
+        io.id
+        ) a
+        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
+            ${ew.customSqlSegment}
+        </if>
+    </select>
     <resultMap id="SampleDefectsChildrenMap" type="com.yuanchu.mom.vo.SampleDefectsChildrenVo">
         <result column="entrust_code" property="entrust_code"/>
         <result column="inspection_item" property="inspection_item"/>
@@ -82,38 +118,6 @@
         create_time,
         state
         from ins_order
-        ) a
-        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
-            ${ew.customSqlSegment}
-        </if>
-    </select>
-    <select id="selectInsOrderPage" resultType="com.yuanchu.mom.dto.SampleOrderDto">
-        select *
-        from (
-        SELECT
-        io.*,
-        ir.id report_id,
-        ir.url,
-        ir.url_s,
-        (select count(*) from ins_sample isa2
-        where isa2.ins_order_id = io.id and isa2.sample_code NOT REGEXP '/') sample_num,
-        concat(ROUND((select count(*) from ins_product ip
-        where state = 1 and ins_result is not null and ip.ins_sample_id in (select id from ins_sample where
-        ins_sample.ins_order_id= io.id )) / (select count(*) from ins_product ip2
-        where state = 1 and ip2.ins_sample_id in (select id from ins_sample where ins_sample.ins_order_id= io.id )) *
-        100, 2), '%') insProgress,
-        group_concat(distinct isa.sample_code,' ') sample_code,
-        group_concat(distinct isa.sample,' ') sample_name,
-        group_concat(distinct isa.model,' ') sample_model,
-        u.name
-        FROM
-        ins_order io
-        LEFT JOIN ins_sample isa ON io.id = isa.ins_order_id
-        LEFT JOIN ( SELECT id, ins_order_id, is_ratify, url,url_s FROM ins_report WHERE is_ratify = 1 ) ir ON io.id =
-        ir.ins_order_id
-        left join user u on io.create_user = u.id
-        GROUP BY
-        io.id
         ) a
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             ${ew.customSqlSegment}
@@ -233,7 +237,9 @@
         </where>
     </update>
     <update id="updateStatus">
-        update ins_order set state=3 where id=#{id}
+        update ins_order
+        set state=3
+        where id = #{id}
     </update>
 
     <select id="selectSampleDefects" resultMap="selectSampleDefectsMap">
@@ -332,4 +338,10 @@
             ${ew.customSqlSegment}
         </if>
     </select>
+
+    <select id="seldepLimsId" resultType="java.lang.String">
+        select name
+        from department_lims
+        where id = #{depLimsId}
+    </select>
 </mapper>

--
Gitblit v1.9.3