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

168 lines
5.4 KiB
XML
Raw Normal View History

<?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.JmImageItemMapper">
<sql id="selectSql">
select
mi.id,
mi.image_id,
mi.left1_lon,
mi.left1_lat,
mi.left2_lon,
mi.left2_lat,
mi.right1_lon,
mi.right1_lat,
mi.right2_lon,
mi.right2_lat,
mi.type,
mi.conf
from jm_image_item mi
join jm_image m on m.id = mi.image_id
left join sys_file f on f.id = m.file_id
</sql>
<select id="selectByJob" resultType="com.zhangy.skyeye.jm.entity.JmImageItem">
<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.JmImageItem">
<include refid="selectSql"/>
where m.job_id = #{jobId}
<if test="type != null">
and f.type = #{type}
</if>
<if test="array != null and array.length > 0">
and m.uav_id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="selectByImage" resultType="com.zhangy.skyeye.jm.entity.JmImageItem">
<include refid="selectSql"/>
where m.id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectById" resultType="com.zhangy.skyeye.jm.entity.JmImageItem">
<include refid="selectSql"/>
where mi.id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
insert into jm_image_item(
id,
image_id,
left1_lon,
left1_lat,
left2_lon,
left2_lat,
right1_lon,
right1_lat,
right2_lon,
right2_lat,
type,
conf
) values
<foreach item="item" index="index" collection="array" separator=",">
(
#{item.id},
#{item.imageId},
#{item.left1Lon},
#{item.left1Lat},
#{item.left2Lon},
#{item.left2Lat},
#{item.right1Lon},
#{item.right1Lat},
#{item.right2Lon},
#{item.right2Lat},
#{item.type},
#{item.conf}
)
</foreach>
</insert>
<update id="updateNotNull">
update jm_image_item
<trim prefix="SET" suffixOverrides=",">
<if test="imageId != null">image_id = #{imageId},</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="type != null">type = #{type},</if>
<if test="conf != null">conf = #{conf},</if>
</trim>
where id = #{id}
</update>
<update id="update">
update jm_image_item
<trim prefix="SET" suffixOverrides=",">
image_id = #{imageId},
left1_lon = #{left1Lon},
left1_lat = #{left1Lat},
left2_lon = #{left2Lon},
left2_lat = #{left2Lat},
right1_lon = #{right1Lon},
right1_lat = #{right1Lat},
right2_lon = #{right2Lon},
right2_lat = #{right2Lat},
type = #{type},
conf = #{conf},
</trim>
where id = #{id}
</update>
<delete id="delete">
delete from jm_image_item where id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteByImage">
delete from jm_image_item where image_id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteByJob">
delete imgt
from jm_image_item imgt
join jm_image img on img.id = imgt.image_id
where img.job_id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteByUav">
delete imgt
from jm_image_item imgt
join jm_image img on img.id = imgt.image_id
where img.job_id = #{jobId}
and img.uav_id in
<foreach item="item" collection="array" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper>