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 INTO member_video(member_id, scenic_id, face_id, template_id, task_id, video_id, is_buy, order_id) VALUES (#{memberId}, #{scenicId}, #{faceId}, #{templateId}, #{taskId}, #{videoId}, #{isBuy}, #{orderId}) ON DUPLICATE KEY UPDATE video_id = VALUES(video_id), is_buy = VALUES(is_buy), order_id = VALUES(order_id) INSERT INTO member_video(member_id, scenic_id, face_id, template_id, task_id, video_id, is_buy, order_id) VALUES (#{item.memberId}, #{item.scenicId}, #{item.faceId}, #{item.templateId}, #{item.taskId}, #{item.videoId}, #{item.isBuy}, #{orderId}) ON DUPLICATE KEY UPDATE video_id = VALUES(video_id), is_buy = VALUES(is_buy), order_id = VALUES(order_id) update video scenic_id = #{scenicId}, template_id = #{templateId}, task_id = #{taskId}, face_id = #{faceId}, video_url = #{videoUrl}, height = #{height}, width = #{width}, duration = #{duration}, where id = #{id} update video set height = #{height}, width = #{width}, duration = #{duration} where id = #{id} update member_video is_buy = #{isBuy}, order_id = #{orderId}, where member_id = #{memberId} and video_id = #{videoId} update member_video set video_id = #{videoId}, is_buy = #{isBuy} where task_id = #{taskId} delete from video where id = #{id} delete from member_video where scenic_id = #{scenicId} and is_buy = 0 and create_time < #{endDate} delete from member_video where member_id = #{userId} and face_id = #{faceId} and is_buy = 0 delete from video where id not in ( select video_id from member_video where video_id is not null ) and id not in ( select video_id from video_review where video_id is not null ) update member_video set member_id = #{memberId} where face_id = #{faceId}