From b9eef68cc85d30b892a1cd50829341d3dae743b9 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 06 一月 2025 13:00:47 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml | 37 ++++++++++++++-----------------------
1 files changed, 14 insertions(+), 23 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..fa68274 100644
--- a/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml
+++ b/zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml
@@ -66,13 +66,12 @@
</select>
<select id="selectPrepareGroup" resultType="java.lang.String">
- SELECT
- group_id
- FROM man_action
- WHERE 1=1
- AND action_sts = (SELECT id FROM man_action_sts WHERE UUID = 'PREPARE')
- AND group_id IS NOT NULL
- GROUP BY group_id
+ SELECT ma.group_id
+ FROM man_action ma
+ JOIN man_action_sts mas ON ma.action_sts = mas.id
+ WHERE mas.UUID = 'PREPARE'
+ AND ma.group_id IS NOT NULL
+ GROUP BY ma.group_id
</select>
<select id="selectTaskIdsByGroupId" resultType="java.lang.Long">
@@ -98,24 +97,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