From 3728fa293e1faf4bf4f9bf41105b84ddb43dc82e Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 02 十一月 2026 16:53:02 +0800
Subject: [PATCH] feat(order-rates): 新增筛选条件下全部订单费用汇总接口

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

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index 60b24f3..796910d 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -195,6 +195,13 @@
             ELSE ios.ins_state
         END AS ins_state,
         ios.verify_tell,
+        CASE WHEN ios.ins_state = 4 AND a.report_is_pass = 0 THEN (
+            SELECT rr.from_stage
+            FROM ins_report_return_record rr
+            WHERE rr.ins_order_id = a.id AND rr.target_stage = 'INSPECTION_TASK'
+            ORDER BY rr.id DESC
+            LIMIT 1
+        ) ELSE NULL END AS report_return_source,
         verify_user
         FROM
         (
@@ -203,6 +210,7 @@
         io.entrust_code,
         io.type,
         io.appointed,
+        io.sample_date,
         io.send_time,
         io.order_type,
         io.task_source,
@@ -240,6 +248,7 @@
         io.type_source,
         io.ifs_inventory_id,
         ira.id ins_report_id,
+        ira.is_pass report_is_pass,
         ira.url,
         ira.url_s,
         ira.temp_url_pdf,
@@ -314,7 +323,7 @@
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             ${ew.customSqlSegment}
         </if>
-        ORDER BY send_time desc
+        ORDER BY (A.sample_date IS NULL) ASC, A.sample_date DESC, A.id DESC, A.son_laboratory ASC
 
     </select>
 

--
Gitblit v1.9.3