| | |
| | | |
| | | <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> |