|
@@ -2,6 +2,36 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
<mapper namespace="com.backendsys.modules.ai.volcengine.dao.VolcengineVideoTaskDao">
|
|
|
|
|
|
+ <sql id="includeVolcengineVideoTask">
|
|
|
+ avvt.id,
|
|
|
+ avvt.user_id,
|
|
|
+ avvt.model,
|
|
|
+ avvt.img_url,
|
|
|
+ avvt.resolution,
|
|
|
+ avvt.duration,
|
|
|
+ avvt.`text`,
|
|
|
+ avvt.camerafixed,
|
|
|
+ avvt.quantity,
|
|
|
+ avvt.create_time,
|
|
|
+ avvt.update_time
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="includeVolcengineVideoTaskDetail">
|
|
|
+ avvtd.id,
|
|
|
+ avvtd.user_id,
|
|
|
+ avvtd.task_id,
|
|
|
+ avvtd.volcengine_task_id,
|
|
|
+ avvtd.cover_img_url,
|
|
|
+ avvtd.seed,
|
|
|
+ avvtd.status,
|
|
|
+ avvtd.video_origin_url,
|
|
|
+ avvtd.video_url,
|
|
|
+ avvtd.object_key,
|
|
|
+ avvtd.error_msg,
|
|
|
+ avvtd.create_time,
|
|
|
+ avvtd.update_time
|
|
|
+ </sql>
|
|
|
+
|
|
|
<!-- 基础映射 -->
|
|
|
<resultMap id="baseTaskMap" type="com.backendsys.modules.ai.volcengine.entity.VolcengineVideoTask">
|
|
|
<id property="id" column="id"/>
|
|
@@ -62,17 +92,19 @@
|
|
|
|
|
|
<!-- 根据用户id 获取任务列表,标记用户是否收藏 -->
|
|
|
<select id="selectTaskList" resultMap="resultMapTask">
|
|
|
- SELECT avvt.*,
|
|
|
- IF(avc.task_id IS NOT NULL, 1, 0) as is_collect
|
|
|
- from ai_volcengine_video_task avvt
|
|
|
+ SELECT
|
|
|
+ <include refid="includeVolcengineVideoTask" />
|
|
|
+ , IF(avc.task_id IS NOT NULL, 1, 0) AS is_collect
|
|
|
+ FROM ai_volcengine_video_task avvt
|
|
|
LEFT JOIN (
|
|
|
- SELECT DISTINCT task_id
|
|
|
- FROM ai_volcengine_video_collect
|
|
|
- WHERE user_id = #{dto.user_id}
|
|
|
+ SELECT
|
|
|
+ DISTINCT task_id
|
|
|
+ FROM ai_volcengine_video_collect
|
|
|
+ WHERE user_id = #{dto.user_id}
|
|
|
) avc ON avc.task_id = avvt.id
|
|
|
<where>
|
|
|
<if test="dto.model != null and dto.model != ''">
|
|
|
- and avvt.model = #{dto.model}
|
|
|
+ AND avvt.model = #{dto.model}
|
|
|
</if>
|
|
|
<if test="dto.create_begin_date != null and dto.create_begin_date != ''">
|
|
|
AND avvt.create_time >= STR_TO_DATE(#{dto.create_begin_date}, '%Y-%m-%d')
|
|
@@ -81,36 +113,39 @@
|
|
|
AND avvt.create_time < DATE_ADD(STR_TO_DATE(#{dto.create_end_date}, '%Y-%m-%d'), INTERVAL 1 DAY)
|
|
|
</if>
|
|
|
</where>
|
|
|
- order by create_time desc
|
|
|
+ ORDER BY create_time DESC
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据任务id和用户id 查询任务明细视频,标记用户是否收藏 -->
|
|
|
<select id="queryDetailById" resultType="com.backendsys.modules.ai.volcengine.entity.VolcengineVideoTaskDetail">
|
|
|
- SELECT avvtd.*,
|
|
|
- IF(avc.task_id IS NOT NULL, 1, 0) as is_collect
|
|
|
+ SELECT
|
|
|
+ <include refid="includeVolcengineVideoTaskDetail" />
|
|
|
+ , IF(avc.task_id IS NOT NULL, 1, 0) AS is_collect
|
|
|
FROM ai_volcengine_video_task_detail avvtd
|
|
|
LEFT JOIN ai_volcengine_video_collect avc
|
|
|
ON avc.task_id = avvtd.task_id
|
|
|
AND avc.task_detail_id = avvtd.id
|
|
|
AND avc.user_id = #{user_id}
|
|
|
WHERE avvtd.task_id = #{id}
|
|
|
- order by update_time desc
|
|
|
+ ORDER BY update_time DESC
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据用户id 获取用户已收藏的任务列表 -->
|
|
|
<select id="selectTaskCollectList"
|
|
|
resultMap="resultMapTaskCollect">
|
|
|
- SELECT avvt.*,
|
|
|
- 1 as is_collect
|
|
|
- from ai_volcengine_video_task avvt
|
|
|
+ SELECT
|
|
|
+ <include refid="includeVolcengineVideoTask" />
|
|
|
+ , 1 AS is_collect
|
|
|
+ FROM ai_volcengine_video_task avvt
|
|
|
INNER JOIN (
|
|
|
- SELECT DISTINCT task_id
|
|
|
- FROM ai_volcengine_video_collect
|
|
|
- WHERE user_id = #{dto.user_id}
|
|
|
+ SELECT
|
|
|
+ DISTINCT task_id
|
|
|
+ FROM ai_volcengine_video_collect
|
|
|
+ WHERE user_id = #{dto.user_id}
|
|
|
) avc ON avc.task_id = avvt.id
|
|
|
<where>
|
|
|
<if test="dto.model != null and dto.model != ''">
|
|
|
- and avvt.model = #{dto.model}
|
|
|
+ AND avvt.model = #{dto.model}
|
|
|
</if>
|
|
|
<if test="dto.create_begin_date != null and dto.create_begin_date != ''">
|
|
|
AND avvt.create_time >= STR_TO_DATE(#{dto.create_begin_date}, '%Y-%m-%d')
|
|
@@ -119,20 +154,21 @@
|
|
|
AND avvt.create_time < DATE_ADD(STR_TO_DATE(#{dto.create_end_date}, '%Y-%m-%d'), INTERVAL 1 DAY)
|
|
|
</if>
|
|
|
</where>
|
|
|
- order by create_time desc
|
|
|
+ ORDER BY create_time DESC
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据任务id和用户id 查询收藏的任务明细视频 -->
|
|
|
<select id="queryDetailCollectById" resultType="com.backendsys.modules.ai.volcengine.entity.VolcengineVideoTaskDetail">
|
|
|
- SELECT avvtd.*,
|
|
|
- 1 as is_collect
|
|
|
+ SELECT
|
|
|
+ <include refid="includeVolcengineVideoTaskDetail" />
|
|
|
+ , 1 AS is_collect
|
|
|
FROM ai_volcengine_video_task_detail avvtd
|
|
|
INNER JOIN ai_volcengine_video_collect avc
|
|
|
ON avc.task_id = avvtd.task_id
|
|
|
AND avc.task_detail_id = avvtd.id
|
|
|
AND avc.user_id = #{user_id}
|
|
|
WHERE avvtd.task_id = #{id}
|
|
|
- order by update_time desc
|
|
|
+ ORDER BY update_time DESC
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|