From 12de000e79c094471e0a5b55cb49b966d5b93721 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 02 八月 2024 13:13:09 +0800
Subject: [PATCH] 检验下单优化查询语句

---
 inspect-server/src/main/resources/mapper/InsSampleMapper.xml |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index ade36d6..f16e99f 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -40,7 +40,8 @@
         isu.user_id,
         user.name userName,
         ip.son_laboratory,
-        io.ins_time
+        io.ins_time,
+        io.laboratory
         FROM
         ins_order io
         LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
@@ -84,7 +85,11 @@
         a.type DESC,
         a.id
         ) b
-        where ins_state is not null)A
+        where ins_state is not null
+        <if test="laboratory!=null and laboratory!=''">
+            and laboratory=#{laboratory}
+        </if>
+        )A
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             ${ew.customSqlSegment}
         </if>
@@ -106,7 +111,8 @@
         isu.user_id,
         user.name userName,
         ip.son_laboratory,
-        io.ins_time
+        io.ins_time,
+        io.laboratory
         FROM
         ins_order io
         LEFT JOIN ins_sample isa ON isa.ins_order_id = io.id
@@ -150,7 +156,11 @@
         a.type DESC,
         a.id
         ) b
-        where ins_state is not null )A
+        where ins_state is not null
+        <if test="laboratory!=null and laboratory!=''">
+            and laboratory=#{laboratory}
+        </if>
+        )A
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             ${ew.customSqlSegment}
         </if>
@@ -268,6 +278,7 @@
         select name_en
         from `center-lims`.product
         where name = #{sample}
+        limit 1
     </select>
     <select id="selectSampleProductListByOrderId2" resultMap="sampleDto">
         select isa.*,

--
Gitblit v1.9.3