| | |
| | | <result property="fileMd5" column="file_md5"/> |
| | | <result property="mediaUrl" column="media_url"/> |
| | | <result property="sourceUrl" column="source_url"/> |
| | | <result property="photoId" column="photo_id"/> |
| | | <result property="longitude" column="longitude"/> |
| | | <result property="latitude" column="latitude"/> |
| | | <result property="height" column="height"/> |
| | | <result property="captureTime" column="capture_time"/> |
| | | <result property="createTime" column="create_time"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <!-- 查询媒体列表:根据条件动态生成SQL --> |
| | | <select id="selectArdMedia" resultMap="ArdMediaResult"> |
| | | SELECT id, task_id, media_type, file_size, file_md5, media_url, source_url,create_time |
| | | SELECT |
| | | id, task_id, media_type, file_size, file_md5, media_url, source_url, |
| | | photo_id, longitude, latitude, height, capture_time, create_time |
| | | FROM ard_media |
| | | <where> |
| | | <!-- 动态查询条件:任务ID --> |
| | | <if test="taskId != null">AND task_id = #{taskId}</if> |
| | | |
| | | <!-- 动态查询条件:媒体类型 --> |
| | | <if test="mediaType != null">AND media_type = #{mediaType}</if> |
| | | |
| | | <!-- 动态查询条件:文件大小 --> |
| | | <if test="fileSize != null">AND file_size = #{fileSize}</if> |
| | | |
| | | <!-- 动态查询条件:文件MD5 --> |
| | | <if test="fileMd5 != null">AND file_md5 = #{fileMd5}</if> |
| | | |
| | | <!-- 动态查询条件:媒体URL --> |
| | | <if test="mediaUrl != null">AND media_url = #{mediaUrl}</if> |
| | | |
| | | <!-- 动态查询条件:时间戳 --> |
| | | <if test="sourceUrl != null">AND source_url = #{sourceUrl}</if> |
| | | <if test="photoId != null">AND photo_id = #{photoId}</if> |
| | | <if test="longitude != null">AND longitude = #{longitude}</if> |
| | | <if test="latitude != null">AND latitude = #{latitude}</if> |
| | | <if test="height != null">AND height = #{height}</if> |
| | | <if test="captureTime != null">AND capture_time = #{captureTime}</if> |
| | | <if test="createTime != null">AND create_time = #{createTime}</if> |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | | |
| | | <!-- 根据任务ID查询媒体 --> |
| | | <select id="selectArdMediaByTaskId" resultMap="ArdMediaResult"> |
| | | SELECT id, task_id, media_type, file_size, file_md5, media_url, create_time |
| | | SELECT id, |
| | | task_id, |
| | | media_type, |
| | | file_size, |
| | | file_md5, |
| | | media_url, |
| | | source_url, |
| | | photo_id, |
| | | longitude, |
| | | latitude, |
| | | height, |
| | | capture_time, |
| | | create_time |
| | | FROM ard_media |
| | | WHERE task_id = #{taskId} |
| | | </select> |
| | | |
| | | <!-- 根据任务ID和媒体类型查询媒体 --> |
| | | <select id="selectArdMediaByTaskIdAndType" resultMap="ArdMediaResult"> |
| | | SELECT id, |
| | | task_id, |
| | | media_type, |
| | | file_size, |
| | | file_md5, |
| | | media_url, |
| | | source_url, |
| | | photo_id, |
| | | longitude, |
| | | latitude, |
| | | height, |
| | | capture_time, |
| | | create_time |
| | | FROM ard_media |
| | | WHERE task_id = #{taskId} |
| | | and media_type = #{mediaType} |
| | | </select> |
| | | <!-- 插入媒体记录 --> |
| | | <insert id="insertArdMedia" parameterType="com.ard.work.domain.entity.ArdMedia"> |
| | | INSERT INTO ard_media |
| | |
| | | <if test="fileMd5 != null">file_md5,</if> |
| | | <if test="mediaUrl != null">media_url,</if> |
| | | <if test="sourceUrl != null">source_url,</if> |
| | | <if test="photoId != null">photo_id,</if> |
| | | <if test="longitude != null">longitude,</if> |
| | | <if test="latitude != null">latitude,</if> |
| | | <if test="height != null">height,</if> |
| | | <if test="captureTime != null">capture_time,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | </trim> |
| | | |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="taskId != null">#{taskId},</if> |
| | |
| | | <if test="fileMd5 != null">#{fileMd5},</if> |
| | | <if test="mediaUrl != null">#{mediaUrl},</if> |
| | | <if test="sourceUrl != null">#{sourceUrl},</if> |
| | | <if test="photoId != null">#{photoId},</if> |
| | | <if test="longitude != null">#{longitude},</if> |
| | | <if test="latitude != null">#{latitude},</if> |
| | | <if test="height != null">#{height},</if> |
| | | <if test="captureTime != null">#{captureTime},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | |
| | | <!-- 批量插入媒体记录 --> |
| | | <insert id="insertArdMediaList" parameterType="java.util.List"> |
| | | INSERT INTO ard_media |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="list != null and !list.isEmpty()"> |
| | | <foreach item="item" collection="list" separator=","> |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="item.taskId != null">task_id,</if> |
| | | <if test="item.mediaType != null">media_type,</if> |
| | | <if test="item.fileSize != null">file_size,</if> |
| | | <if test="item.fileMd5 != null">file_md5,</if> |
| | | <if test="item.mediaUrl != null">media_url,</if> |
| | | <if test="item.sourceUrl != null">source_url,</if> |
| | | <if test="item.createTime != null">create_time,</if> |
| | | </trim> |
| | | </foreach> |
| | | </if> |
| | | </trim> |
| | | |
| | | <trim prefix="values " suffix=")" suffixOverrides=","> |
| | | <foreach item="item" collection="list" separator=","> |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="item.taskId != null">#{item.taskId},</if> |
| | | <if test="item.mediaType != null">#{item.mediaType},</if> |
| | | <if test="item.fileSize != null">#{item.fileSize},</if> |
| | | <if test="item.fileMd5 != null">#{item.fileMd5},</if> |
| | | <if test="item.mediaUrl != null">#{item.mediaUrl},</if> |
| | | <if test="item.sourceUrl != null">#{item.sourceUrl},</if> |
| | | <if test="item.createTime != null">#{item.createTime},</if> |
| | | </trim> |
| | | </foreach> |
| | | </trim> |
| | | INSERT INTO ard_media( |
| | | task_id, |
| | | media_type, |
| | | file_size, |
| | | file_md5, |
| | | media_url, |
| | | source_url, |
| | | photo_id, |
| | | longitude, |
| | | latitude, |
| | | height, |
| | | capture_time, |
| | | create_time |
| | | ) |
| | | VALUES |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.taskId}, |
| | | #{item.mediaType}, |
| | | #{item.fileSize}, |
| | | #{item.fileMd5}, |
| | | #{item.mediaUrl}, |
| | | #{item.sourceUrl}, |
| | | #{item.photoId}, |
| | | #{item.longitude}, |
| | | #{item.latitude}, |
| | | #{item.height}, |
| | | #{item.captureTime}, |
| | | #{item.createTime} |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | |
| | |
| | | |
| | | <!-- 删除媒体记录 --> |
| | | <delete id="deleteArdMediaById" parameterType="Integer"> |
| | | DELETE FROM ard_media WHERE id = #{id} |
| | | DELETE |
| | | FROM ard_media |
| | | WHERE id = #{id} |
| | | </delete> |
| | | |
| | | <!-- 批量删除媒体记录 --> |
| | |
| | | </delete> |
| | | |
| | | <delete id="deleteArdMediaByTaskId" parameterType="java.lang.Integer"> |
| | | DELETE FROM ard_media WHERE task_id = #{taskId} |
| | | DELETE |
| | | FROM ard_media |
| | | WHERE task_id = #{taskId} |
| | | </delete> |
| | | |
| | | </mapper> |