#
vincentlu
2025-03-27 cd67e854d4715bc92a16dc7bffdbde7be1da9957
zy-acs-manager/src/main/resources/mapper/manager/ActionMapper.xml
@@ -65,14 +65,22 @@
        ORDER BY count DESC
    </select>
    <select id="selectPrepareGroup" resultType="java.lang.String">
        SELECT
        group_id
    <select id="selectGroupNo" 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 action_sts = #{actionSts}
        AND group_id IS NOT NULL
        GROUP BY group_id
    </select>
    <select id="selectPrepareGroup" resultType="java.lang.String">
        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 +106,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>