refactor(video): 将视频实体中的workerId字段改为faceId

- 修改VideoEntity类中字段workerId为faceId,并更新注释
- 更新TaskTaskServiceImpl中设置视频信息的逻辑,使用faceId替代workerId
- 修改VideoMapper.xml中插入视频记录的SQL语句,字段由workerId改为faceId
- 调整VideoMapper.xml中更新视频记录的SQL条件,使用faceId进行筛选
- 更新VideoMapper.xml中查询视频列表和单个视频详情的SQL语句,字段名由workerId改为faceId
- 优化查询条件中对faceId的处理逻辑,直接关联video表的face_id字段
This commit is contained in:
2025-12-15 16:50:17 +08:00
parent 0665eef37d
commit 7348994427
4 changed files with 11 additions and 20 deletions

View File

@@ -34,9 +34,9 @@ public class VideoEntity {
*/
private Long taskId;
/**
* 执行任务的机器ID,render_worker.id
* 人脸ID,对应face.id
*/
private Long workerId;
private Long faceId;
/**
* 视频链接
*/

View File

@@ -27,11 +27,6 @@ public class VideoRepository {
public static final String VIDEO_CACHE_KEY = "video:%s";
public static final String VIDEO_BY_TASK_ID_CACHE_KEY = "video:task:%s";
@Autowired
@Lazy
private PriceBiz priceBiz;
@Autowired
private IVoucherService iVoucherService;
@Autowired
private MemberRelationRepository memberRelationRepository;
public VideoEntity getVideo(Long videoId) {

View File

@@ -492,7 +492,7 @@ public class TaskTaskServiceImpl implements TaskService {
video.setScenicId(task.getScenicId());
video.setTemplateId(task.getTemplateId());
video.setTaskId(taskId);
video.setWorkerId(worker.getId());
video.setFaceId(task.getFaceId());
video.setVideoUrl(task.getVideoUrl());
video.setCreateTime(new Date());
if (req.getVideoInfo() != null) {

View File

@@ -2,8 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycwl.basic.mapper.VideoMapper">
<insert id="add">
insert into video(id, scenic_id, template_id, task_id, worker_id, video_url, height, width, duration)
values (#{id}, #{scenicId}, #{templateId}, #{taskId}, #{workerId}, #{videoUrl}, #{height}, #{width}, #{duration})
insert into video(id, scenic_id, template_id, task_id, face_id, video_url, height, width, duration)
values (#{id}, #{scenicId}, #{templateId}, #{taskId}, #{faceId}, #{videoUrl}, #{height}, #{width}, #{duration})
</insert>
<insert id="addRelation">
INSERT INTO member_video(member_id, scenic_id, face_id, template_id, task_id, video_id, is_buy, order_id)
@@ -30,7 +30,7 @@
<if test="scenicId!= null">scenic_id = #{scenicId}, </if>
<if test="templateId!= null">template_id = #{templateId}, </if>
<if test="taskId!= null">task_id = #{taskId}, </if>
<if test="workerId!= null">worker_id = #{workerId}, </if>
<if test="faceId!= null">face_id = #{faceId}, </if>
<if test="videoUrl!= null">video_url = #{videoUrl}, </if>
<if test="height!= null">height = #{height}, </if>
<if test="width!= null">width = #{width}, </if>
@@ -78,7 +78,7 @@
)
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
select v.id, v.scenic_id, v.template_id, task_id, tk.worker_id, v.video_url, v.create_time, v.update_time,
select v.id, v.scenic_id, v.template_id, v.task_id, v.face_id, tk.worker_id, v.video_url, v.create_time, v.update_time,
t.name templateName, t.cover_url templateCoverUrl,
tk.task_params taskParams, tk.start_time, tk.end_time
from video v
@@ -87,20 +87,16 @@
<where>
<if test="scenicId!= null">and v.scenic_id = #{scenicId} </if>
<if test="templateId!= null">and v.template_id = #{templateId} </if>
<if test="taskId!=null">and task_id = #{taskId}</if>
<if test="workerId!= null">and t.worker_id = #{workerId} </if>
<if test="taskId!=null">and v.task_id = #{taskId}</if>
<if test="workerId!= null">and tk.worker_id = #{workerId} </if>
<if test="startTime!= null">and v.create_time &gt;= #{startTime} </if>
<if test="endTime!= null">and v.create_time &lt;= #{endTime} </if>
<if test="faceId!= null">
and v.task_id in (
select id from task where face_id = #{faceId}
)
</if>
<if test="faceId!= null">and v.face_id = #{faceId}</if>
</where>
order by v.create_time desc
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
select v.id, v.scenic_id, v.template_id, task_id, tk.worker_id, v.video_url, v.create_time, v.update_time,
select v.id, v.scenic_id, v.template_id, v.task_id, v.face_id, tk.worker_id, v.video_url, v.create_time, v.update_time,
t.name templateName, t.cover_url templateCoverUrl,
tk.task_params taskParams, tk.start_time, tk.end_time
from video v