From 4e8a1c02b45f72f6377603778e8c8746ed82f374 Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Tue, 06 Jan 2026 10:04:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
ard-work/src/main/resources/mapper/ArdMediaVideoMapper.xml | 94 ++++++++++++++++------------------------------
1 files changed, 33 insertions(+), 61 deletions(-)
diff --git a/ard-work/src/main/resources/mapper/ArdMediaVideoMapper.xml b/ard-work/src/main/resources/mapper/ArdMediaVideoMapper.xml
index a87800d..a19d361 100644
--- a/ard-work/src/main/resources/mapper/ArdMediaVideoMapper.xml
+++ b/ard-work/src/main/resources/mapper/ArdMediaVideoMapper.xml
@@ -6,7 +6,7 @@
<mapper namespace="com.ard.work.mapper.ArdMediaVideoMapper">
<!-- 结果映射 -->
- <resultMap id="ArdMediaVideoResult" type="com.ard.work.domain.entity.ArdMediaVideo">
+ <resultMap id="ArdMediaVideoResult" type="ArdMediaVideo">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="fileSize" column="file_size"/>
@@ -19,6 +19,7 @@
<result property="taskId" column="task_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
+ <result property="syncStatus" column="sync_status"/>
</resultMap>
<!-- 查询视频列表 -->
@@ -26,51 +27,29 @@
SELECT
id, name, file_size, media_url, source_url, thumbnail_url,
start_time, end_time, span_seconds, task_id,
- create_time, update_time
+ create_time, update_time,sync_status
FROM ard_media_video
<where>
<if test="taskId != null">AND task_id = #{taskId}</if>
<if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
<if test="startTime != null">AND start_time >= #{startTime}</if>
<if test="endTime != null">AND end_time <= #{endTime}</if>
+ <if test="syncStatus != null">AND sync_status = #{syncStatus}</if>
</where>
ORDER BY start_time DESC
</select>
- <!-- 查询 media_url 或 thumbnail_url 为 NULL 的视频 -->
- <select id="selectVideosWithNullMedia" resultMap="ArdMediaVideoResult">
- SELECT
- id, name, file_size, media_url, source_url, thumbnail_url,
- start_time, end_time, span_seconds, task_id,
- create_time, update_time
- FROM ard_media_video where media_url IS NULL
- ORDER BY start_time ASC
- </select>
- <select id="selectVideosWithThumbnailNull" resultMap="ArdMediaVideoResult">
- SELECT
- id, name, file_size, media_url, source_url, thumbnail_url,
- start_time, end_time, span_seconds, task_id,
- create_time, update_time
- FROM ard_media_video where thumbnail_url IS NULL
- ORDER BY start_time ASC
- </select>
-
- <!-- 根据ID查询 -->
- <select id="selectArdMediaVideoById" resultMap="ArdMediaVideoResult">
- SELECT
- id, name, file_size, media_url, source_url, thumbnail_url,
- start_time, end_time, span_seconds, task_id,
- create_time, update_time
+ <!-- 查询待处理的视频 -->
+ <select id="selectPendingVideos" resultMap="ArdMediaVideoResult">
+ SELECT *
FROM ard_media_video
- WHERE id = #{id}
+ WHERE sync_status = 0
+ ORDER BY id LIMIT #{limit}
</select>
<!-- 根据任务ID查询 -->
<select id="selectArdMediaVideoByTaskId" resultMap="ArdMediaVideoResult">
- SELECT
- id, name, file_size, media_url, source_url, thumbnail_url,
- start_time, end_time, span_seconds, task_id,
- create_time, update_time
+ SELECT *
FROM ard_media_video
WHERE task_id = #{taskId}
ORDER BY start_time DESC
@@ -78,33 +57,12 @@
<!-- 新增视频 -->
<insert id="insertArdMediaVideo" parameterType="com.ard.work.domain.entity.ArdMediaVideo">
- INSERT INTO ard_media_video (
- id, name, file_size, media_url, source_url, thumbnail_url,
- start_time, end_time, span_seconds, task_id,
- create_time, update_time
- ) VALUES (
- #{id}, #{name}, #{fileSize}, #{mediaUrl}, #{sourceUrl}, #{thumbnailUrl},
- #{startTime}, #{endTime}, #{spanSeconds}, #{taskId},
- #{createTime}, #{updateTime}
- )
- </insert>
-
- <!-- 批量新增 -->
- <insert id="insertArdMediaVideoList">
- INSERT INTO ard_media_video (
- id, name, file_size, media_url, source_url, thumbnail_url,
- start_time, end_time, span_seconds, task_id,
- create_time, update_time
- )
- VALUES
- <foreach collection="list" item="item" separator=",">
- (
- #{item.id}, #{item.name}, #{item.fileSize},
- #{item.mediaUrl}, #{item.sourceUrl}, #{item.thumbnailUrl},
- #{item.startTime}, #{item.endTime}, #{item.spanSeconds},
- #{item.taskId}, #{item.createTime}, #{item.updateTime}
- )
- </foreach>
+ INSERT INTO ard_media_video (id, name, file_size, media_url, source_url, thumbnail_url,
+ start_time, end_time, span_seconds, task_id,
+ create_time, update_time, sync_status)
+ VALUES (#{id}, #{name}, #{fileSize}, #{mediaUrl}, #{sourceUrl}, #{thumbnailUrl},
+ #{startTime}, #{endTime}, #{spanSeconds}, #{taskId},
+ #{createTime}, #{updateTime}, 0)
</insert>
<!-- 更新视频 -->
@@ -120,17 +78,31 @@
<if test="endTime != null">end_time = #{endTime},</if>
<if test="spanSeconds != null">span_seconds = #{spanSeconds},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
+ <if test="syncStatus != null">sync_status = #{syncStatus},</if>
</set>
WHERE id = #{id}
</update>
-
+ <!-- 标记为处理中 -->
+ <update id="markProcessing">
+ UPDATE ard_media_video SET sync_status = 1 WHERE id = #{id} AND sync_status = 0
+ </update>
+ <!-- 更新同步状态 -->
+ <update id="updateSyncStatus">
+ UPDATE ard_media_video
+ SET sync_status = #{status},update_time = NOW()
+ WHERE id = #{id}
+ </update>
<!-- 删除 -->
<delete id="deleteArdMediaVideoById">
- DELETE FROM ard_media_video WHERE id = #{id}
+ DELETE
+ FROM ard_media_video
+ WHERE id = #{id}
</delete>
<delete id="deleteArdMediaVideoByTaskId">
- DELETE FROM ard_media_video WHERE task_id = #{taskId}
+ DELETE
+ FROM ard_media_video
+ WHERE task_id = #{taskId}
</delete>
</mapper>
--
Gitblit v1.9.3