<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.zy.acs.manager.manager.mapper.ActionMapper">
|
|
<!-- 关联查询sql -->
|
<sql id="selectSql">
|
SELECT a.*
|
FROM man_action a
|
<where>
|
AND a.deleted = 0
|
<if test="param.id != null">
|
AND a.id = #{param.id}
|
</if>
|
<if test="param.seqNum != null">
|
AND a.seq_num = #{param.seqNum}
|
</if>
|
<if test="param.taskId != null">
|
AND a.task_id = #{param.taskId}
|
</if>
|
<if test="param.actionType != null">
|
AND a.action_type = #{param.actionType}
|
</if>
|
<if test="param.actionSts != null">
|
AND a.action_sts = #{param.actionSts}
|
</if>
|
<if test="param.status != null">
|
AND a.status = #{param.status}
|
</if>
|
<if test="param.keywords != null">
|
AND (
|
a.memo LIKE CONCAT('%', #{param.keywords}, '%')
|
OR a.memo LIKE CONCAT('%', #{param.keywords}, '%')
|
)
|
</if>
|
</where>
|
order by a.create_time desc
|
</sql>
|
|
<update id="updateStsByGroupId">
|
update man_action set action_sts = #{actionSts} where group_id = #{groupId}
|
</update>
|
|
<select id="selectRecentForInout" resultType="java.util.Map">
|
SELECT
|
magv.uuid AS agvNo,
|
mat.name
|
FROM man_action ma
|
LEFT JOIN man_action_type mat ON ma.action_type = mat.id
|
LEFT JOIN man_agv magv ON ma.agv_id = magv.id
|
WHERE 1=1
|
AND mat.uuid IN ('ReadyTakeFromShelvesLoc', 'ReadyTakeFromAgvSite', 'ReadyReleaseToShelvesLoc', 'ReadyReleaseToAgvSite')
|
ORDER BY ma.id DESC
|
LIMIT 0, 10
|
</select>
|
|
<select id="selectCountGroupByType" resultType="java.util.Map">
|
SELECT
|
mat.uuid,
|
mat.name,
|
COUNT(ma.action_type) AS count
|
FROM man_action_type mat
|
LEFT JOIN man_action ma ON ma.`action_type` = mat.`id`
|
WHERE 1=1
|
GROUP BY mat.uuid, mat.name
|
ORDER BY count DESC
|
</select>
|
|
<select id="selectGroupNo" resultType="java.lang.String">
|
SELECT group_id
|
FROM man_action
|
WHERE 1=1
|
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">
|
SELECT
|
DISTINCT task_id
|
FROM man_action
|
WHERE 1=1
|
AND group_id = #{groupId}
|
AND task_id IS NOT NULL
|
</select>
|
|
<select id="selectSortCodeByAgv" resultType="java.lang.String">
|
SELECT
|
ma.code
|
FROM man_action ma
|
WHERE 1=1
|
AND ma.action_sts IN (
|
SELECT id FROM man_action_sts WHERE UUID IN ('PREPARE', 'ISSUED')
|
)
|
AND ma.agv_id = #{agvId}
|
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>
|