|  |  | 
 |  |  |         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"> | 
 |  |  | 
 |  |  |         ORDER BY ma.priority DESC | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="selectLatestOfGroup" resultType="com.zy.acs.manager.manager.entity.Action"> | 
 |  |  |         SELECT * | 
 |  |  |         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} | 
 |  |  |             GROUP BY group_id | 
 |  |  |         ) 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> |