452 lines
17 KiB
XML
452 lines
17 KiB
XML
<?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="cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskDetailMapper">
|
|
|
|
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDetailDO">
|
|
<!--@Table robot_task_detail-->
|
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
|
<result property="robotTaskId" column="robot_task_id" jdbcType="INTEGER"/>
|
|
<result property="taskType" column="task_type" jdbcType="INTEGER"/>
|
|
<result property="releaseType" column="release_type" jdbcType="INTEGER"/>
|
|
<result property="takeType" column="take_type" jdbcType="INTEGER"/>
|
|
<result property="releaseId" column="release_id" jdbcType="INTEGER"/>
|
|
<result property="takeId" column="take_id" jdbcType="INTEGER"/>
|
|
<result property="fromLocationNo" column="from_location_no" jdbcType="VARCHAR"/>
|
|
<result property="fromLocationId" column="from_location_id" jdbcType="INTEGER"/>
|
|
<result property="toLocationNo" column="to_location_no" jdbcType="VARCHAR"/>
|
|
<result property="toLocationId" column="to_location_id" jdbcType="INTEGER"/>
|
|
<result property="fromLocationStorey" column="from_location_storey" jdbcType="INTEGER"/>
|
|
<result property="toLocationStorey" column="to_location_storey" jdbcType="INTEGER"/>
|
|
<result property="priority" column="priority" jdbcType="INTEGER"/>
|
|
<result property="robotNo" column="robot_no" jdbcType="VARCHAR"/>
|
|
<result property="robotAction" column="robot_action" jdbcType="VARCHAR"/>
|
|
<result property="taskStatus" column="task_status" jdbcType="INTEGER"/>
|
|
<result property="taskStage" column="task_stage" jdbcType="INTEGER"/>
|
|
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
|
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
|
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
|
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
|
|
</resultMap>
|
|
|
|
<!--查询单个-->
|
|
<sql id="base_sql">
|
|
id,
|
|
robot_task_id,
|
|
task_type,
|
|
release_type,
|
|
take_type,
|
|
release_id,
|
|
take_id,
|
|
from_location_no,
|
|
from_location_id,
|
|
to_location_no,
|
|
to_location_id,
|
|
robot_no,
|
|
robot_action,
|
|
task_status,
|
|
task_stage,
|
|
start_time,
|
|
end_time,
|
|
creator,
|
|
create_time,
|
|
updater,
|
|
update_time,
|
|
deleted,
|
|
tenant_id,
|
|
from_location_storey,
|
|
to_location_storey,
|
|
priority
|
|
</sql>
|
|
|
|
<!--查询指定行数据-->
|
|
<select id="queryAllByLimit" resultMap="BaseResultMap">
|
|
select
|
|
id, robot_task_id, task_type, release_type, take_type, release_id, take_id, from_location_no, from_location_id,
|
|
to_location_no, to_location_id, robot_no, robot_action, task_status, task_stage, start_time, end_time, creator,
|
|
create_time, updater, update_time, deleted, tenant_id
|
|
from robot_task_detail
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="robotTaskId != null">
|
|
and robot_task_id = #{robotTaskId}
|
|
</if>
|
|
<if test="taskType != null">
|
|
and task_type = #{taskType}
|
|
</if>
|
|
<if test="releaseType != null">
|
|
and release_type = #{releaseType}
|
|
</if>
|
|
<if test="takeType != null">
|
|
and take_type = #{takeType}
|
|
</if>
|
|
<if test="releaseId != null">
|
|
and release_id = #{releaseId}
|
|
</if>
|
|
<if test="takeId != null">
|
|
and take_id = #{takeId}
|
|
</if>
|
|
<if test="fromLocationNo != null and fromLocationNo != ''">
|
|
and from_location_no = #{fromLocationNo}
|
|
</if>
|
|
<if test="fromLocationId != null">
|
|
and from_location_id = #{fromLocationId}
|
|
</if>
|
|
<if test="toLocationNo != null and toLocationNo != ''">
|
|
and to_location_no = #{toLocationNo}
|
|
</if>
|
|
<if test="toLocationId != null">
|
|
and to_location_id = #{toLocationId}
|
|
</if>
|
|
<if test="robotNo != null and robotNo != ''">
|
|
and robot_no = #{robotNo}
|
|
</if>
|
|
<if test="robotAction != null and robotAction != ''">
|
|
and robot_action = #{robotAction}
|
|
</if>
|
|
<if test="taskStatus != null">
|
|
and task_status = #{taskStatus}
|
|
</if>
|
|
<if test="taskStage != null">
|
|
and task_stage = #{taskStage}
|
|
</if>
|
|
<if test="startTime != null">
|
|
and start_time = #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and end_time = #{endTime}
|
|
</if>
|
|
<if test="creator != null and creator != ''">
|
|
and creator = #{creator}
|
|
</if>
|
|
<if test="createTime != null">
|
|
and create_time = #{createTime}
|
|
</if>
|
|
<if test="updater != null and updater != ''">
|
|
and updater = #{updater}
|
|
</if>
|
|
<if test="updateTime != null">
|
|
and update_time = #{updateTime}
|
|
</if>
|
|
<if test="deleted != null">
|
|
and deleted = #{deleted}
|
|
</if>
|
|
<if test="tenantId != null">
|
|
and tenant_id = #{tenantId}
|
|
</if>
|
|
</where>
|
|
limit #{pageable.offset}, #{pageable.pageSize}
|
|
</select>
|
|
|
|
<!--通过实体作为筛选条件查询-->
|
|
<select id="queryAll" resultMap="BaseResultMap">
|
|
select
|
|
id, robot_task_id, task_type, release_type, take_type, release_id, take_id, from_location_no, from_location_id,
|
|
to_location_no, to_location_id, robot_no, robot_action, task_status, task_stage, start_time, end_time, creator,
|
|
create_time, updater, update_time, deleted, tenant_id
|
|
from robot_task_detail
|
|
</select>
|
|
<!--统计总行数-->
|
|
<select id="count" resultType="java.lang.Long">
|
|
select count(1)
|
|
from robot_task_detail
|
|
<where>
|
|
<if test="id != null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="robotTaskId != null">
|
|
and robot_task_id = #{robotTaskId}
|
|
</if>
|
|
<if test="taskType != null">
|
|
and task_type = #{taskType}
|
|
</if>
|
|
<if test="releaseType != null">
|
|
and release_type = #{releaseType}
|
|
</if>
|
|
<if test="takeType != null">
|
|
and take_type = #{takeType}
|
|
</if>
|
|
<if test="releaseId != null">
|
|
and release_id = #{releaseId}
|
|
</if>
|
|
<if test="takeId != null">
|
|
and take_id = #{takeId}
|
|
</if>
|
|
<if test="fromLocationNo != null and fromLocationNo != ''">
|
|
and from_location_no = #{fromLocationNo}
|
|
</if>
|
|
<if test="fromLocationId != null">
|
|
and from_location_id = #{fromLocationId}
|
|
</if>
|
|
<if test="toLocationNo != null and toLocationNo != ''">
|
|
and to_location_no = #{toLocationNo}
|
|
</if>
|
|
<if test="toLocationId != null">
|
|
and to_location_id = #{toLocationId}
|
|
</if>
|
|
<if test="robotNo != null and robotNo != ''">
|
|
and robot_no = #{robotNo}
|
|
</if>
|
|
<if test="robotAction != null and robotAction != ''">
|
|
and robot_action = #{robotAction}
|
|
</if>
|
|
<if test="taskStatus != null">
|
|
and task_status = #{taskStatus}
|
|
</if>
|
|
<if test="taskStage != null">
|
|
and task_stage = #{taskStage}
|
|
</if>
|
|
<if test="startTime != null">
|
|
and start_time = #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and end_time = #{endTime}
|
|
</if>
|
|
<if test="creator != null and creator != ''">
|
|
and creator = #{creator}
|
|
</if>
|
|
<if test="createTime != null">
|
|
and create_time = #{createTime}
|
|
</if>
|
|
<if test="updater != null and updater != ''">
|
|
and updater = #{updater}
|
|
</if>
|
|
<if test="updateTime != null">
|
|
and update_time = #{updateTime}
|
|
</if>
|
|
<if test="deleted != null">
|
|
and deleted = #{deleted}
|
|
</if>
|
|
<if test="tenantId != null">
|
|
and tenant_id = #{tenantId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="queryDoingTaskByIds" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="base_sql"></include>
|
|
from
|
|
robot_task_detail
|
|
where
|
|
from_location_id in
|
|
<foreach collection="locationIds" item="id" index="index" open="(" close=")"
|
|
separator=",">
|
|
#{id}
|
|
</foreach>
|
|
and deleted = '0'
|
|
and task_status in ('0','1')
|
|
</select>
|
|
|
|
<select id="getSingleUnDoTask" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="base_sql"></include>
|
|
from
|
|
robot_task_detail
|
|
where
|
|
task_status = '0'
|
|
and deleted = '0'
|
|
<if test="taskIds != null and taskIds.size() > 0">
|
|
and robot_task_id in
|
|
<foreach collection="taskIds" item="taskId" index="index" open="(" close=")"
|
|
separator=",">
|
|
#{taskId}
|
|
</foreach>
|
|
</if>
|
|
order by priority desc, create_time asc ,robot_no desc
|
|
</select>
|
|
|
|
|
|
<select id="queryByTaskId" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="base_sql"></include>
|
|
from
|
|
robot_task_detail
|
|
where
|
|
robot_task_id = #{robotTaskId}
|
|
and deleted = '0'
|
|
</select>
|
|
|
|
<select id="getUnDoTaskDetail" resultMap="BaseResultMap">
|
|
SELECT
|
|
*
|
|
FROM (
|
|
SELECT *,
|
|
ROW_NUMBER() OVER (PARTITION BY robot_task_id order by priority desc, create_time asc ,robot_no desc) AS rn
|
|
FROM
|
|
robot_task_detail
|
|
where
|
|
task_status = '0'
|
|
and deleted = '0'
|
|
<if test="montageTaskIds != null and montageTaskIds.size() > 0">
|
|
and robot_task_id in
|
|
<foreach collection="montageTaskIds" item="taskId" index="index" open="(" close=")"
|
|
separator=",">
|
|
#{taskId}
|
|
</foreach>
|
|
</if>
|
|
) AS user
|
|
WHERE rn = 1
|
|
union
|
|
select
|
|
*, tenant_id as rn
|
|
from
|
|
robot_task_detail
|
|
where
|
|
task_status = '0'
|
|
and deleted = '0'
|
|
<if test="singleTaskIds != null and singleTaskIds.size() > 0">
|
|
and robot_task_id in
|
|
<foreach collection="singleTaskIds" item="taskId" index="index" open="(" close=")"
|
|
separator=",">
|
|
#{taskId}
|
|
</foreach>
|
|
</if>
|
|
order by priority desc, create_time asc ,robot_no desc
|
|
</select>
|
|
|
|
|
|
<select id="getMontageUnDoTask" resultMap="BaseResultMap">
|
|
SELECT
|
|
*
|
|
FROM (
|
|
SELECT *,
|
|
ROW_NUMBER() OVER (PARTITION BY robot_task_id order by id asc ) AS rn
|
|
FROM robot_task_detail
|
|
where
|
|
task_status = '0'
|
|
and deleted = '0'
|
|
<if test="montageTaskIds != null and montageTaskIds.size() > 0">
|
|
and robot_task_id in
|
|
<foreach collection="montageTaskIds" item="taskId" index="index" open="(" close=")"
|
|
separator=",">
|
|
#{taskId}
|
|
</foreach>
|
|
</if>
|
|
) AS user
|
|
WHERE rn = 1
|
|
order by priority desc, create_time asc ,robot_no desc
|
|
</select>
|
|
|
|
<select id="getDoingTaskIds" resultType="java.lang.Long">
|
|
select
|
|
distinct
|
|
robot_task_id
|
|
from
|
|
robot_task_detail
|
|
where
|
|
task_status = '1'
|
|
and deleted = '0'
|
|
</select>
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insertSelect" keyProperty="id" useGeneratedKeys="true">
|
|
insert into robot_task_detail(robot_task_id, task_type, release_type, take_type, release_id, take_id,
|
|
from_location_no, from_location_id, to_location_no, to_location_id, robot_no,
|
|
robot_action, task_status, task_stage, start_time, end_time, creator, create_time,
|
|
updater, update_time, deleted, tenant_id)
|
|
values (#{robotTaskId}, #{taskType}, #{releaseType}, #{takeType}, #{releaseId}, #{takeId}, #{fromLocationNo},
|
|
#{fromLocationId}, #{toLocationNo}, #{toLocationId}, #{robotNo}, #{robotAction}, #{taskStatus},
|
|
#{taskStage}, #{startTime}, #{endTime}, #{creator}, #{createTime}, #{updater}, #{updateTime},
|
|
#{deleted}, #{tenantId})
|
|
</insert>
|
|
|
|
<!--keyProperty="id" useGeneratedKeys="true"-->
|
|
<insert id="insertBatchList" >
|
|
insert into robot_task_detail(robot_task_id, task_type, release_type, take_type, release_id, take_id,
|
|
from_location_no, from_location_id, to_location_no, to_location_id, robot_no,from_location_storey,
|
|
to_location_storey,priority)
|
|
values
|
|
<foreach collection="taskDetailList" item="entity" separator=",">
|
|
(#{entity.robotTaskId}, #{entity.taskType}, #{entity.releaseType}, #{entity.takeType}, #{entity.releaseId},
|
|
#{entity.takeId}, #{entity.fromLocationNo}, #{entity.fromLocationId}, #{entity.toLocationNo},
|
|
#{entity.toLocationId}, #{entity.robotNo}, #{entity.fromLocationStorey}, #{entity.toLocationStorey}
|
|
, #{entity.priority})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="updateRobotDetailById">
|
|
update robot_task_detail
|
|
<set>
|
|
<if test="robotTaskId != null">
|
|
robot_task_id = #{robotTaskId},
|
|
</if>
|
|
<if test="taskType != null">
|
|
task_type = #{taskType},
|
|
</if>
|
|
<if test="releaseType != null">
|
|
release_type = #{releaseType},
|
|
</if>
|
|
<if test="takeType != null">
|
|
take_type = #{takeType},
|
|
</if>
|
|
<if test="releaseId != null">
|
|
release_id = #{releaseId},
|
|
</if>
|
|
<if test="takeId != null">
|
|
take_id = #{takeId},
|
|
</if>
|
|
<if test="fromLocationNo != null and fromLocationNo != ''">
|
|
from_location_no = #{fromLocationNo},
|
|
</if>
|
|
<if test="fromLocationId != null">
|
|
from_location_id = #{fromLocationId},
|
|
</if>
|
|
<if test="toLocationNo != null and toLocationNo != ''">
|
|
to_location_no = #{toLocationNo},
|
|
</if>
|
|
<if test="toLocationId != null">
|
|
to_location_id = #{toLocationId},
|
|
</if>
|
|
<if test="robotNo != null and robotNo != ''">
|
|
robot_no = #{robotNo},
|
|
</if>
|
|
<if test="robotAction != null and robotAction != ''">
|
|
robot_action = #{robotAction},
|
|
</if>
|
|
<if test="taskStatus != null">
|
|
task_status = #{taskStatus},
|
|
</if>
|
|
<if test="taskStage != null">
|
|
task_stage = #{taskStage},
|
|
</if>
|
|
<if test="startTime != null">
|
|
start_time = #{startTime},
|
|
</if>
|
|
<if test="endTime != null">
|
|
end_time = #{endTime},
|
|
</if>
|
|
<if test="creator != null and creator != ''">
|
|
creator = #{creator},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time = #{createTime},
|
|
</if>
|
|
<if test="updater != null and updater != ''">
|
|
updater = #{updater},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
update_time = #{updateTime},
|
|
</if>
|
|
<if test="deleted != null">
|
|
deleted = #{deleted},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete
|
|
from robot_task_detail
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
|
|
</mapper> |