skyeyesystem/backend/Skyeye-sys-dev/skyeye-service-manager/target/classes/mapping/jm/JmJobPayloadMapping.xml

158 lines
4.8 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.zhangy.skyeye.jm.mapper.JmJobPayloadMapper">
<sql id="selectSql">
select
jp.job_id,
jp.uav_id,
jp.payload_id,
jp.width,
jp.length,
jp.theta,
jp.reserved,
jp.resolution,
jp.direction,
jp.auto_focus,
jp.moto,
jp.image_Light,
jp.heading_diff,
jp.image_bit,
jp.status,
jp.end_time,
p.ip,
p.type,
p.name as payload_name
from jm_job_payload jp
left join se_payload p on p.id = jp.payload_id
</sql>
<select id="selectByJob" resultType="com.zhangy.skyeye.jm.entity.JmJobPayload">
<include refid="selectSql"/>
where jp.job_id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectByUav" resultType="com.zhangy.skyeye.jm.entity.JmJobPayload">
<include refid="selectSql"/>
where jp.job_id = #{jobId}
<if test="uavId != null">
and jp.uav_id = #{uavId}
</if>
</select>
<select id="selectSar" resultType="com.zhangy.skyeye.jm.entity.JmJobPayload">
<include refid="selectSql"/>
where jp.job_id = #{jobId}
and jp.uav_id = #{uavId}
and p.type = 'SAR'
</select>
<insert id="insert">
insert into jm_job_payload(
job_id,
uav_id,
payload_id,
status,
width,
length,
theta,
reserved,
direction,
resolution,
auto_focus,
image_light,
heading_diff,
image_bit,
moto,
end_time
) values
<foreach item="item" index="index" collection="array" separator=",">
(
#{item.jobId},
#{item.uavId},
#{item.payloadId},
#{item.status},
#{item.width},
#{item.length},
#{item.theta},
#{item.reserved},
#{item.direction},
#{item.resolution},
#{item.autoFocus},
#{item.imageLight},
#{item.headingDiff},
#{item.imageBit},
#{item.moto},
#{item.endTime}
)
</foreach>
</insert>
<update id="updateNotNull">
update jm_job_payload
<trim prefix="SET" suffixOverrides=",">
<if test="uavId != null">uav_id = #{uavId},</if>
<if test="status != null">status = #{status},</if>
<if test="width != null">width = #{width},</if>
<if test="length != null">length = #{length},</if>
<if test="theta != null">theta = #{theta},</if>
<if test="reserved != null">reserved = #{reserved},</if>
<if test="direction != null">direction = #{direction},</if>
<if test="resolution != null">resolution = #{resolution},</if>
<if test="autoFocus != null">auto_focus = #{autoFocus},</if>
<if test="moto != null">moto = #{moto},</if>
<if test="endTime != null">end_time = #{endTime},</if>
</trim>
where job_id = #{jobId}
and payload_id = #{payloadId}
</update>
<update id="update">
update jm_job_payload
<trim prefix="SET" suffixOverrides=",">
uav_id = #{uavId},
status = #{status},
width = #{width},
length = #{length},
theta = #{theta},
reserved = #{reserved},
direction = #{direction},
resolution = #{resolution},
auto_focus = #{autoFocus},
image_light = #{imageLight},
moto = #{moto},
end_time = #{endTime},
</trim>
where jobId = #{jobId}
and payload_id = #{payloadId}
</update>
<delete id="delete">
delete from jm_job_payload
where job_id = #{jobId}
and uav_id = #{uavId}
and payload_id = #{payloadId}
</delete>
<delete id="deleteByJob">
delete from jm_job_payload
where job_id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteByUav">
delete from jm_job_payload
where job_id = #{jobId}
<if test="array != null and array.length > 0">
and uav_id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</delete>
</mapper>