Files
FT517-WCS/ruoyi-admin/src/main/resources/mapper/job/MydoJobMapper.xml
2025-09-25 10:36:55 +08:00

196 lines
12 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="com.ruoyi.job.mapper.MydoJobMapper">
<resultMap type="MydoJob" id="MydoJobResult">
<result property="jobId" column="job_id" />
<result property="status" column="status" />
<result property="taskNo" column="task_no" />
<result property="roadwayId" column="roadway_id" />
<result property="cargoSpaceId" column="cargo_space_id" />
<result property="targetRoadwayId" column="target_roadway_id" />
<result property="targetCargoSpaceId" column="target_cargo_space_id" />
<result property="priority" column="priority" />
<result property="executionPhase" column="execution_phase" />
<result property="inOrOut" column="in_or_out" />
<result property="createTime" column="create_time" />
<result property="startTime" column="start_time" />
<result property="finishTime" column="finish_time" />
<result property="entranceId" column="entrance_id" />
<result property="exitId" column="exit_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="faultFlag" column="fault_flag" />
</resultMap>
<sql id="selectMydoJobVo">
select job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag from mydo_job_wcs
</sql>
<select id="selectMydoJobList" parameterType="MydoJob" resultMap="MydoJobResult">
<include refid="selectMydoJobVo"/>
<where>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
<if test="roadwayId != null and roadwayId != ''"> and roadway_id = #{roadwayId}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if>
<if test="targetRoadwayId != null and targetRoadwayId != ''"> and target_roadway_id = #{targetRoadwayId}</if>
<if test="targetCargoSpaceId != null and targetCargoSpaceId != ''"> and target_cargo_space_id = #{targetCargoSpaceId}</if>
<if test="priority != null "> and priority = #{priority}</if>
<if test="executionPhase != null and executionPhase != ''"> and execution_phase = #{executionPhase}</if>
<if test="inOrOut != null and inOrOut != ''"> and in_or_out = #{inOrOut}</if>
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
<if test="entranceId != null and entranceId != ''"> and entrance_id = #{entranceId}</if>
<if test="exitId != null and exitId != ''"> and exit_id = #{exitId}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="faultFlag != null and faultFlag != ''"> and fault_flag = #{faultFlag}</if>
</where>
</select>
<select id="selectMydoJobByJobId" parameterType="String" resultMap="MydoJobResult">
<include refid="selectMydoJobVo"/>
where job_id = #{jobId}
</select>
<select id="ddjTaskFinish" parameterType="java.util.Map" statementType="CALLABLE">
{call proc_mydojob_finish(
#{v_rwh,mode=IN,jdbcType=INTEGER},
#{v_ddj_id,mode=IN,jdbcType=INTEGER},
#{v_result,mode=OUT,jdbcType=INTEGER},
#{v_resultmsg,mode=OUT,jdbcType=VARCHAR}
)}
</select>
<select id="InvalidMydoJob" parameterType="java.util.Map" statementType="CALLABLE">
{call proc_mydojob_invalid(
#{v_rwh,mode=IN,jdbcType=INTEGER},
#{v_ddj_id,mode=IN,jdbcType=INTEGER},
#{v_result,mode=OUT,jdbcType=INTEGER},
#{v_resultmsg,mode=OUT,jdbcType=VARCHAR}
)}
</select>
<select id="selectMydoJobByExitList" resultMap="MydoJobResult">
select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag from mydo_job_wcs
where exit_id in
<foreach item="item" index="index" collection="exitList" separator="," open="(" close=")">
#{item}
</foreach>
and in_or_out > 20
and status = 1 and execution_phase= 0
order by priority desc,create_time desc
</select>
<insert id="insertMydoJob" parameterType="MydoJob">
insert into mydo_job_wcs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jobId != null">job_id,</if>
<if test="status != null and status != ''">status,</if>
<if test="taskNo != null and taskNo != ''">task_no,</if>
<if test="roadwayId != null">roadway_id,</if>
<if test="cargoSpaceId != null">cargo_space_id,</if>
<if test="targetRoadwayId != null">target_roadway_id,</if>
<if test="targetCargoSpaceId != null">target_cargo_space_id,</if>
<if test="priority != null">priority,</if>
<if test="executionPhase != null">execution_phase,</if>
<if test="inOrOut != null">in_or_out,</if>
<if test="createTime != null">create_time,</if>
<if test="startTime != null">start_time,</if>
<if test="finishTime != null">finish_time,</if>
<if test="entranceId != null">entrance_id,</if>
<if test="exitId != null">exit_id,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="faultFlag != null">fault_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jobId != null">#{jobId},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="taskNo != null and taskNo != ''">#{taskNo},</if>
<if test="roadwayId != null">#{roadwayId},</if>
<if test="cargoSpaceId != null">#{cargoSpaceId},</if>
<if test="targetRoadwayId != null">#{targetRoadwayId},</if>
<if test="targetCargoSpaceId != null">#{targetCargoSpaceId},</if>
<if test="priority != null">#{priority},</if>
<if test="executionPhase != null">#{executionPhase},</if>
<if test="inOrOut != null">#{inOrOut},</if>
<if test="createTime != null">#{createTime},</if>
<if test="startTime != null">#{startTime},</if>
<if test="finishTime != null">#{finishTime},</if>
<if test="entranceId != null">#{entranceId},</if>
<if test="exitId != null">#{exitId},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="faultFlag != null">#{faultFlag},</if>
</trim>
</insert>
<insert id="insertHistory">
insert into mydo_job_wcs_history
select * from mydo_job_wcs where job_id = #{jobId}
</insert>
<update id="updateMydoJob" parameterType="MydoJob">
update mydo_job_wcs
<trim prefix="SET" suffixOverrides=",">
<if test="status != null and status != ''">status = #{status},</if>
<if test="taskNo != null and taskNo != ''">task_no = #{taskNo},</if>
<if test="roadwayId != null">roadway_id = #{roadwayId},</if>
<if test="cargoSpaceId != null">cargo_space_id = #{cargoSpaceId},</if>
<if test="targetRoadwayId != null">target_roadway_id = #{targetRoadwayId},</if>
<if test="targetCargoSpaceId != null">target_cargo_space_id = #{targetCargoSpaceId},</if>
<if test="priority != null">priority = #{priority},</if>
<if test="executionPhase != null">execution_phase = #{executionPhase},</if>
<if test="inOrOut != null">in_or_out = #{inOrOut},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="finishTime != null">finish_time = #{finishTime},</if>
<if test="entranceId != null">entrance_id = #{entranceId},</if>
<if test="exitId != null">exit_id = #{exitId},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="faultFlag != null">fault_flag = #{faultFlag},</if>
</trim>
where job_id = #{jobId}
</update>
<delete id="deleteMydoJobByJobId" parameterType="String">
delete from mydo_job_wcs where job_id = #{jobId}
</delete>
<delete id="deleteMydoJobByJobIds" parameterType="String">
delete from mydo_job_wcs where job_id in
<foreach item="jobId" collection="array" open="(" separator="," close=")">
#{jobId}
</foreach>
</delete>
<select id="selectInOrOutMydoJobList" parameterType="MydoJob" resultMap="MydoJobResult">
<include refid="selectMydoJobVo"/>
<where>
<if test="inOut != null and inOut != '' and inOut =='2'.toString "> and in_or_out >=20</if>
<if test="inOut != null and inOut != '' and inOut =='1'.toString "> and in_or_out &lt; 20</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="taskNo != null and taskNo != ''"> and task_no = #{taskNo}</if>
<if test="roadwayId != null and roadwayId != ''"> and roadway_id = #{roadwayId}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if>
<if test="targetRoadwayId != null and targetRoadwayId != ''"> and target_roadway_id = #{targetRoadwayId}</if>
<if test="targetCargoSpaceId != null and targetCargoSpaceId != ''"> and target_cargo_space_id = #{targetCargoSpaceId}</if>
<if test="priority != null "> and priority = #{priority}</if>
<if test="executionPhase != null and executionPhase != ''"> and execution_phase = #{executionPhase}</if>
<if test="inOrOut != null and inOrOut != ''"> and in_or_out = #{inOrOut}</if>
<if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if>
<if test="finishTime != null and finishTime != ''"> and finish_time = #{finishTime}</if>
<if test="entranceId != null and entranceId != ''"> and entrance_id = #{entranceId}</if>
<if test="exitId != null and exitId != ''"> and exit_id = #{exitId}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="faultFlag != null and faultFlag != ''"> and fault_flag = #{faultFlag}</if>
<if test="jobId != null and jobId != ''"> and job_id = #{jobId}</if>
</where>
</select>
<select id="selectMydoJobByEntranceList" resultMap="MydoJobResult">
select TOP 1 job_id, status, task_no, roadway_id, cargo_space_id, target_roadway_id, target_cargo_space_id, priority, execution_phase, in_or_out, create_time, start_time, finish_time, entrance_id, exit_id, warehouse_id, fault_flag from mydo_job_wcs
where entrance_id in
<foreach item="item" index="index" collection="entranceList" separator="," open="(" close=")">
#{item}
</foreach>
and in_or_out &lt;= 20 ans status = 3
order by priority desc,create_time desc
</select>
</mapper>