235 lines
7.7 KiB
XML
235 lines
7.7 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.JmImageMapper">
|
|
<sql id="selectSql">
|
|
select
|
|
m.id,
|
|
m.name,
|
|
m.job_id, j.name as job_name,
|
|
m.uav_id,
|
|
m.payload_id,
|
|
m.airline_id,
|
|
m.file_id,
|
|
m.frame_no,
|
|
m.max,
|
|
m.left1_lon,
|
|
m.left1_lat,
|
|
m.left2_lon,
|
|
m.left2_lat,
|
|
m.right1_lon,
|
|
m.right1_lat,
|
|
m.right2_lon,
|
|
m.right2_lat,
|
|
m.image_time,
|
|
m.create_time,
|
|
f.name as file_name,
|
|
f.type as file_type,
|
|
f.path as file_path,
|
|
f.relative_path as relative_path
|
|
from jm_image m
|
|
left join sys_file f on f.id = m.file_id
|
|
left join jm_job j on j.id = m.job_id
|
|
</sql>
|
|
|
|
<select id="selectPage" resultType="com.zhangy.skyeye.jm.entity.JmImage">
|
|
<include refid="selectSql"/>
|
|
where f.type in
|
|
<foreach item="item" collection="type" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="createTimeBegin != null">
|
|
and f.create_time >= #{createTimeBegin}
|
|
</if>
|
|
<if test="createTimeEnd != null">
|
|
and f.create_time <= #{createTimeEnd}
|
|
</if>
|
|
<if test="name != null and name != ''">
|
|
and f.name like concat('%', #{name}, '%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectByJob" resultType="com.zhangy.skyeye.jm.entity.JmImage">
|
|
<include refid="selectSql"/>
|
|
where m.job_id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="type != null">
|
|
and f.type = #{type}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectByUav" resultType="com.zhangy.skyeye.jm.entity.JmImage">
|
|
<include refid="selectSql"/>
|
|
where m.job_id = #{jobId}
|
|
<if test="array != null and array.length > 0">
|
|
and m.uav_id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="type != null">
|
|
and f.type = #{type}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectByAirline" resultType="com.zhangy.skyeye.jm.entity.JmImage">
|
|
<include refid="selectSql"/>
|
|
where m.airline_id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="type != null">
|
|
and f.type = #{type}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectById" resultType="com.zhangy.skyeye.jm.entity.JmImage">
|
|
<include refid="selectSql"/>
|
|
where m.id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="selectByName" resultType="com.zhangy.skyeye.jm.entity.JmImage">
|
|
<include refid="selectSql"/>
|
|
where f.type = #{type}
|
|
<if test="array != null and array.length > 0">
|
|
and f.name in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="jobId != null">
|
|
and m.job_id = #{jobId}
|
|
</if>
|
|
</select>
|
|
|
|
<insert id="insert" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
|
insert into jm_image(
|
|
id,
|
|
name,
|
|
job_id,
|
|
uav_id,
|
|
payload_id,
|
|
airline_id,
|
|
file_id,
|
|
frame_no,
|
|
max,
|
|
left1_lon,
|
|
left1_lat,
|
|
left2_lon,
|
|
left2_lat,
|
|
right1_lon,
|
|
right1_lat,
|
|
right2_lon,
|
|
right2_lat,
|
|
image_time,
|
|
create_time
|
|
) values
|
|
<foreach item="item" index="index" collection="array" separator=",">
|
|
(
|
|
#{item.id},
|
|
#{item.name},
|
|
#{item.jobId},
|
|
#{item.uavId},
|
|
#{item.payloadId},
|
|
#{item.airlineId},
|
|
#{item.fileId},
|
|
#{item.frameNo},
|
|
#{item.max},
|
|
#{item.left1Lon},
|
|
#{item.left1Lat},
|
|
#{item.left2Lon},
|
|
#{item.left2Lat},
|
|
#{item.right1Lon},
|
|
#{item.right1Lat},
|
|
#{item.right2Lon},
|
|
#{item.right2Lat},
|
|
#{item.imageTime},
|
|
#{item.createTime}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateNotNull">
|
|
update jm_image
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="jobId != null">job_id = #{jobId},</if>
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="uavId != null">uav_id = #{uavId},</if>
|
|
<if test="payloadId != null">payload_id = #{payloadId},</if>
|
|
<if test="airlineId != null">airline_id = #{airlineId},</if>
|
|
<if test="fileId != null">file_id = #{fileId},</if>
|
|
<if test="frameNo != null">frame_no = #{frameNo},</if>
|
|
<if test="max != null">max = #{max},</if>
|
|
<if test="left1Lon != null">left1_lon = #{left1Lon},</if>
|
|
<if test="left1Lat != null">left1_lat = #{left1Lat},</if>
|
|
<if test="left2Lon != null">left2_lon = #{left2Lon},</if>
|
|
<if test="left2Lat != null">left2_lat = #{left2Lat},</if>
|
|
<if test="right1Lon != null">right1_lon = #{right1Lon},</if>
|
|
<if test="right1Lat != null">right1_lat = #{right1Lat},</if>
|
|
<if test="right2Lon != null">right2_lon = #{right2Lon},</if>
|
|
<if test="right2Lat != null">right2_lat = #{right2Lat},</if>
|
|
<if test="imageTime != null">image_time = #{imageTime},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="update">
|
|
update jm_image
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
job_id = #{jobId},
|
|
name = #{name},
|
|
uav_id = #{uavId},
|
|
payload_id = #{payloadId},
|
|
airline_id = #{airlineId},
|
|
file_id = #{fileId},
|
|
frame_no = #{frameNo},
|
|
max = #{max},
|
|
left1_lon = #{left1Lon},
|
|
left1_lat = #{left1Lat},
|
|
left2_lon = #{left2Lon},
|
|
left2_lat = #{left2Lat},
|
|
right1_lon = #{right1Lon},
|
|
right1_lat = #{right1Lat},
|
|
right2_lon = #{right2Lon},
|
|
right2_lat = #{right2Lat},
|
|
image_time = #{imageTime},
|
|
create_time = #{createTime},
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="delete">
|
|
delete from jm_image where id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteByJob">
|
|
delete from jm_image where job_id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteByUav">
|
|
delete img
|
|
from jm_image img
|
|
where img.job_id = #{jobId}
|
|
<if test="array != null and array.length > 0">
|
|
and img.uav_id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="type != null">
|
|
and exists(select 1 from sys_file f where f.id = img.file_id and f.type = #{type})
|
|
</if>
|
|
</delete>
|
|
</mapper> |