DROP PROCEDURE IF EXISTS sp_city_mas; DELIMITER $$ CREATE PROCEDURE sp_city_mas() BEGIN #附件迁移 # 迁移 MAS 视频,6个wcm节点的视频是在一起的。可重复执行。 # 支持断点续传,上一次迁移的最后一个 xx ID SET @prevMasId = ifnull((SELECT prev_id from data_migration_log where table_name = 'mas_masid'), 0); SET @prevMasVideoId = ifnull((SELECT prev_id from data_migration_log where table_name = 'mas_masvideo'), 0); SET @prevVideoStream = ifnull((SELECT prev_id from data_migration_log where table_name = 'mas_videostream'), 0); SET @prevPublishedVideo = ifnull((SELECT prev_id from data_migration_log where table_name = 'mas_publishedvideo'), 0); #mas视频迁移 SET @maxMasId = IFNULL((SELECT MAX(ID) from trs_mas.mas_masid),0); SET @masIdOffset = @maxMasId - @prevMasId; SET @maxMasVideoId = IFNULL((SELECT MAX(ID) from trs_mas.mas_masvideo),0); SET @masVideoIdOffset = @maxMasVideoId - @prevMasVideoId; SET @maxVideostreamId = IFNULL((SELECT MAX(ID) from trs_mas.mas_videostream),0); SET @masVideostreamIdOffset = @maxVideostreamId - @prevVideoStream; call sp_data_migration_masid(@prevMasId, @masIdOffset); call sp_data_migration_masvideo(@prevMasVideoId, @masIdOffset); call sp_data_migration_mas_videostream(@prevVideoStream, @masVideostreamIdOffset, @masIdOffset); call sp_data_migration_mas_publishedvideo(@prevPublishedVideo, @masIdOffset); END $$ DELIMITER ;