| New file |
| | |
| | | <?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.ard.work.mapper.ArdMediaPicMapper"> |
| | | |
| | | <resultMap id="ArdMediaPicResult" type="ArdMediaPic"> |
| | | <result property="id" column="id"/> |
| | | <result property="fileSize" column="file_size"/> |
| | | <result property="fileMd5" column="file_md5"/> |
| | | <result property="mediaUrl" column="media_url"/> |
| | | <result property="sourceUrl" column="source_url"/> |
| | | <result property="longitude" column="longitude"/> |
| | | <result property="latitude" column="latitude"/> |
| | | <result property="height" column="height"/> |
| | | <result property="taskId" column="task_id"/> |
| | | <result property="captureTime" column="capture_time"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="syncStatus" column="sync_status"/> |
| | | </resultMap> |
| | | |
| | | <!-- 查询图片列表 --> |
| | | <select id="selectPicList" resultMap="ArdMediaPicResult"> |
| | | SELECT * |
| | | FROM ard_media_pic |
| | | <where> |
| | | <if test="taskId != null">AND task_id = #{taskId}</if> |
| | | <if test="syncStatus != null">AND sync_status = #{syncStatus}</if> |
| | | </where> |
| | | ORDER BY capture_time DESC |
| | | </select> |
| | | <!-- 查询待处理的图片 --> |
| | | <select id="selectPendingPics" resultMap="ArdMediaPicResult"> |
| | | SELECT * |
| | | FROM ard_media_pic |
| | | WHERE sync_status = 0 |
| | | ORDER BY id LIMIT #{limit} |
| | | </select> |
| | | |
| | | <!-- 根据任务ID查询图片 --> |
| | | <select id="selectPicByTaskId" resultMap="ArdMediaPicResult"> |
| | | SELECT * FROM ard_media_pic WHERE task_id = #{taskId} |
| | | ORDER BY capture_time DESC |
| | | </select> |
| | | |
| | | <!-- 插入图片 --> |
| | | <insert id="insertPic" parameterType="ArdMediaPic"> |
| | | INSERT INTO ard_media_pic ( |
| | | id, task_id, file_size, file_md5, |
| | | media_url, source_url, |
| | | longitude, latitude, height, |
| | | capture_time, create_time,sync_status |
| | | ) VALUES ( |
| | | #{id}, #{taskId}, #{fileSize}, #{fileMd5}, |
| | | #{mediaUrl}, #{sourceUrl}, |
| | | #{longitude}, #{latitude}, #{height}, |
| | | #{captureTime}, #{createTime},0 |
| | | ) |
| | | </insert> |
| | | |
| | | <!-- 更新图片(按需补全字段) --> |
| | | <update id="updatePic" parameterType="ArdMediaPic"> |
| | | UPDATE ard_media_pic |
| | | <set> |
| | | <if test="mediaUrl != null"> |
| | | media_url = #{mediaUrl}, |
| | | </if> |
| | | <if test="fileSize != null"> |
| | | file_size = #{fileSize}, |
| | | </if> |
| | | <if test="fileMd5 != null"> |
| | | file_md5 = #{fileMd5}, |
| | | </if> |
| | | <if test="captureTime != null"> |
| | | capture_time = #{captureTime}, |
| | | </if> |
| | | <if test="longitude != null"> |
| | | longitude = #{longitude}, |
| | | </if> |
| | | <if test="latitude != null"> |
| | | latitude = #{latitude}, |
| | | </if> |
| | | <if test="height != null"> |
| | | height = #{height}, |
| | | </if> |
| | | <if test="syncStatus != null"> |
| | | sync_status = #{syncStatus}, |
| | | </if> |
| | | update_time = #{updateTime} |
| | | </set> |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | <!-- 标记为处理中 --> |
| | | <update id="markProcessing"> |
| | | UPDATE ard_media_pic SET sync_status = 1 WHERE id = #{id} AND sync_status = 0 |
| | | </update> |
| | | <!-- 更新同步状态 --> |
| | | <update id="updateSyncStatus"> |
| | | UPDATE ard_media_pic |
| | | SET sync_status = #{status},update_time = NOW() |
| | | WHERE id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deletePicById"> |
| | | DELETE FROM ard_media_pic WHERE id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deletePicByTaskId"> |
| | | DELETE FROM ard_media_pic WHERE task_id = #{taskId} |
| | | </delete> |
| | | |
| | | </mapper> |