From 766bcd63a19f7acaff2f5ed2cd1cb016894978ea Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 23 十二月 2024 14:06:12 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml |   24 ++++++++----------------
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml b/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml
index 488e2fb..5e5ac69 100644
--- a/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml
+++ b/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml
@@ -98,24 +98,16 @@
 
     <select id="selectLatestOfGroup" resultType="com.zy.acs.manager.manager.entity.Action">
         SELECT *
-        FROM man_action
-        WHERE 1=1
-        AND agv_id = #{agvId}
-        AND action_sts = #{actionSts}
-        AND group_id IN (
-            SELECT group_id
+        FROM man_action a
+        JOIN (
+            SELECT group_id, MAX(io_time) AS max_io_time
             FROM man_action
-            WHERE agv_id = #{agvId}
-            AND action_sts = #{actionSts}
+            WHERE agv_id = #{agvId} AND action_sts = #{actionSts}
             GROUP BY group_id
-            HAVING MAX(io_time) = (
-                SELECT MAX(io_time)
-                FROM man_action
-                WHERE agv_id = #{agvId}
-                AND action_sts = #{actionSts}
-            )
-        )
-        ORDER BY priority DESC
+        ) b ON a.group_id = b.group_id AND a.io_time = b.max_io_time
+        WHERE a.agv_id = #{agvId}
+        AND a.action_sts = #{actionSts}
+        ORDER BY a.priority DESC
     </select>
 
 </mapper>

--
Gitblit v1.9.1