You've already forked FrameTour-BE
feat(source): 增强source关联关系的数据一致性校验
- 在SourceMapper中新增sourceExists方法,用于校验source是否存在 - 新增filterValidSourceRelations方法,过滤无效的source引用 - 在FaceServiceImpl中增强关联关系创建逻辑,防止重复和无效数据 - 在VideoPieceGetter任务中增加source存在性校验,避免创建孤立关联- 添加详细的日志记录,便于追踪关联关系创建过程 -优化XML映射文件,支持新的校验和过滤查询逻辑
This commit is contained in:
@@ -51,6 +51,40 @@
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="sourceExists" resultType="boolean">
|
||||
SELECT COUNT(1) > 0 FROM source WHERE id = #{sourceId}
|
||||
</select>
|
||||
<select id="filterValidSourceRelations" resultType="com.ycwl.basic.model.pc.source.entity.MemberSourceEntity">
|
||||
<if test="list != null and list.size() > 0">
|
||||
SELECT
|
||||
r.memberId as memberId,
|
||||
r.sourceId as sourceId,
|
||||
r.type as type,
|
||||
r.faceId as faceId,
|
||||
r.scenicId as scenicId,
|
||||
r.isBuy as isBuy,
|
||||
r.orderId as orderId,
|
||||
r.isFree as isFree,
|
||||
r.id as id
|
||||
FROM (
|
||||
<foreach collection="list" item="item" separator="UNION ALL ">
|
||||
SELECT
|
||||
#{item.memberId} as memberId,
|
||||
#{item.sourceId} as sourceId,
|
||||
#{item.type} as type,
|
||||
#{item.faceId} as faceId,
|
||||
#{item.scenicId} as scenicId,
|
||||
#{item.isBuy} as isBuy,
|
||||
#{item.orderId} as orderId,
|
||||
#{item.isFree} as isFree,
|
||||
#{item.id} as id
|
||||
</foreach>
|
||||
) r
|
||||
WHERE EXISTS (
|
||||
SELECT 1 FROM source s WHERE s.id = r.sourceId
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<insert id="addSourceWatermark">
|
||||
insert source_watermark(source_id, face_id, watermark_type, watermark_url)
|
||||
values (#{sourceId}, #{faceId}, #{type}, #{url})
|
||||
|
||||
Reference in New Issue
Block a user