0_update_data_relation_appendix.sql 1.1 KB

123456789101112131415161718192021222324
  1. DROP PROCEDURE IF EXISTS update_data_relation_appendix;
  2. DELIMITER $$
  3. CREATE PROCEDURE update_data_relation_appendix(IN n INT,
  4. IN mas_url VARCHAR(200),
  5. IN prevTableInfoId BIGINT(20),
  6. IN prevDocId BIGINT(20))
  7. BEGIN
  8. SET @citySuffix = concat('_city', n);
  9. SET @wcmdocument_offset_num = ifnull((SELECT max(offset_num) FROM data_migration_offset WHERE table_name = 'wcmdocument'), 0);
  10. SET @docIdOffset = @wcmdocument_offset_num;
  11. SET @appendix_offset_num = ifnull((SELECT max(offset_num) FROM data_migration_offset WHERE table_name = 'xwcmmaterial'), 0);
  12. SET @appendixIdOffset = @appendix_offset_num;
  13. call update_data_relation_appendix_1(prevDocId, @appendixIdOffset, @docIdOffset);
  14. call update_data_relation_appendix_2(@citySuffix, prevTableInfoId, prevDocId);
  15. UPDATE trs_hycloud_iip.wcmappendix SET APPFILE = CONCAT(mas_url, AppFromId) WHERE APPFLAG = 90 AND APPENDIXID > @appendixIdOffset;
  16. END $$
  17. DELIMITER ;