|
@@ -1,13 +1,20 @@
|
|
|
DROP PROCEDURE IF EXISTS update_data_relation_appendix;
|
|
|
DELIMITER $$
|
|
|
CREATE PROCEDURE update_data_relation_appendix(IN n INT,
|
|
|
- IN mas_url VARCHAR(200))
|
|
|
+ IN mas_url VARCHAR(200),
|
|
|
+ IN prevTableInfoId BIGINT(20),
|
|
|
+ IN prevDocId BIGINT(20))
|
|
|
BEGIN
|
|
|
|
|
|
SET @citySuffix = concat('_city', n);
|
|
|
-
|
|
|
- SET @prevDocId = ifnull((SELECT prev_id from data_migration_log where table_name = 'wcmdocument'), 0);
|
|
|
- SET @prevTableInfoId = ifnull((SELECT prev_id from data_migration_log where table_name = 'xwcmtableinfo'), 0);
|
|
|
+ if prevDocId = 0
|
|
|
+ then
|
|
|
+ SET prevDocId = ifnull((SELECT prev_id from data_migration_log where table_name = 'wcmdocument'), 0);
|
|
|
+ end if;
|
|
|
+ if prevTableInfoId = 0
|
|
|
+ then
|
|
|
+ SET prevTableInfoId = ifnull((SELECT prev_id from data_migration_log where table_name = 'xwcmtableinfo'), 0);
|
|
|
+ end if;
|
|
|
|
|
|
SET @wcmdocument_offset_num = ifnull((SELECT max(offset_num) FROM data_migration_offset WHERE table_name = 'wcmdocument'), 0);
|
|
|
SET @docIdOffset = @wcmdocument_offset_num;
|
|
@@ -15,9 +22,9 @@ CREATE PROCEDURE update_data_relation_appendix(IN n INT,
|
|
|
SET @appendix_offset_num = ifnull((SELECT max(offset_num) FROM data_migration_offset WHERE table_name = 'xwcmmaterial'), 0);
|
|
|
SET @appendixIdOffset = @appendix_offset_num;
|
|
|
|
|
|
- call update_data_relation_appendix_1(@prevDocId, @appendixIdOffset, @docIdOffset);
|
|
|
+ call update_data_relation_appendix_1(prevDocId, @appendixIdOffset, @docIdOffset);
|
|
|
|
|
|
- call update_data_relation_appendix_2(@citySuffix, @prevTableInfoId, @prevDocId);
|
|
|
+ call update_data_relation_appendix_2(@citySuffix, prevTableInfoId, prevDocId);
|
|
|
|
|
|
UPDATE trs_hycloud_iip.wcmappendix SET APPFILE = CONCAT(mas_url, AppFromId) WHERE APPFLAG = 90 AND APPENDIXID > @appendixIdOffset;
|
|
|
|