You've already forked FrameTour-BE
feat(source): 增强source关联关系的数据一致性校验
- 在SourceMapper中新增sourceExists方法,用于校验source是否存在 - 新增filterValidSourceRelations方法,过滤无效的source引用 - 在FaceServiceImpl中增强关联关系创建逻辑,防止重复和无效数据 - 在VideoPieceGetter任务中增加source存在性校验,避免创建孤立关联- 添加详细的日志记录,便于追踪关联关系创建过程 -优化XML映射文件,支持新的校验和过滤查询逻辑
This commit is contained in:
@@ -355,7 +355,13 @@ public class VideoPieceGetter {
|
||||
&& memberSourceEntity.getFaceId().equals(videoSource.getFaceId());
|
||||
});
|
||||
if (!anyMatch) {
|
||||
sourceMapper.addRelation(videoSource);
|
||||
// 验证source是否存在,防止创建孤立的关联关系
|
||||
if (sourceMapper.sourceExists(videoSource.getSourceId())) {
|
||||
sourceMapper.addRelation(videoSource);
|
||||
} else {
|
||||
log.warn("尝试创建关联关系但source不存在: sourceId={}, faceId={}, memberId={}",
|
||||
videoSource.getSourceId(), videoSource.getFaceId(), videoSource.getMemberId());
|
||||
}
|
||||
}
|
||||
memberRelationRepository.clearSCacheByFace(task.faceId);
|
||||
}
|
||||
@@ -395,7 +401,13 @@ public class VideoPieceGetter {
|
||||
&& memberSourceEntity.getFaceId().equals(videoSource.getFaceId());
|
||||
});
|
||||
if (!anyMatch) {
|
||||
sourceMapper.addRelation(videoSource);
|
||||
// 验证source是否存在,防止创建孤立的关联关系
|
||||
if (sourceMapper.sourceExists(videoSource.getSourceId())) {
|
||||
sourceMapper.addRelation(videoSource);
|
||||
} else {
|
||||
log.warn("尝试创建关联关系但source不存在: sourceId={}, faceId={}, memberId={}",
|
||||
videoSource.getSourceId(), videoSource.getFaceId(), videoSource.getMemberId());
|
||||
}
|
||||
}
|
||||
memberRelationRepository.clearSCacheByFace(task.faceId);
|
||||
}
|
||||
|
Reference in New Issue
Block a user