|
|
|
@@ -10,8 +10,7 @@ ADD COLUMN `final_tenant_id` varchar(5) NOT NULL COMMENT '归属租户ID' AFTER |
|
|
|
update wx_c_user_basic_info set final_tenant_id = parent_tenant_id; |
|
|
|
update wx_c_user_basic_info set final_tenant_id = tenant_id where (parent_tenant_id is null or trim(parent_tenant_id) = ""); |
|
|
|
|
|
|
|
DROP INDEX `PHONE_UNIQUE`, |
|
|
|
ADD UNIQUE INDEX `PHONE_UNIQUE`(`final_tenant_id`, `phone`) USING BTREE; |
|
|
|
ALTER TABLE wx_c_user_basic_info ADD UNIQUE INDEX `PHONE_UNIQUE`(`final_tenant_id`, `phone`) USING BTREE; |
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE `wx_c_user_basic_info` |
|
|
|
@@ -69,5 +68,42 @@ ADD COLUMN `from_id` BIGINT(20) DEFAULT NULL COMMENT '来源ID,针对续签, |
|
|
|
合同状态为4(即将到期)更新为计租中,合同状态为8(补录),9(续签)更新为草稿。 |
|
|
|
|
|
|
|
|
|
|
|
CREATE DEFINER=`root`@`%` PROCEDURE `cuser_old_to_new`(IN `oldCuserId` bigint,IN `newCuserId` bigint) |
|
|
|
BEGIN |
|
|
|
DECLARE err_flag INT DEFAULT FALSE; |
|
|
|
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET err_flag = TRUE; |
|
|
|
|
|
|
|
UPDATE wx_c_user SET user_id = newCuserId WHERE user_id = oldCuserId ; |
|
|
|
UPDATE wx_activity_join SET user_id = newCuserId WHERE user_id = oldCuserId ; |
|
|
|
UPDATE wx_c_user_tags SET user_id = newCuserId WHERE user_id = oldCuserId ; |
|
|
|
UPDATE wx_game_action_log SET user_id = newCuserId WHERE user_id = oldCuserId ; |
|
|
|
UPDATE wx_order_group SET user_id = newCuserId WHERE user_id = oldCuserId ; |
|
|
|
UPDATE wx_order_press SET user_id = newCuserId WHERE user_id = oldCuserId ; |
|
|
|
UPDATE wx_question_log SET user_id = newCuserId WHERE user_id = oldCuserId ; |
|
|
|
|
|
|
|
UPDATE wx_c_user_car SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
UPDATE wx_c_user_from_b SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
UPDATE wx_coupon_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
UPDATE wx_credit_history SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
UPDATE wx_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
UPDATE wx_pay_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
UPDATE wx_refund_order SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
UPDATE wx_score_history SET c_user_id = newCuserId WHERE c_user_id = oldCuserId ; |
|
|
|
|
|
|
|
UPDATE wx_card_spend SET owner_id = newCuserId WHERE owner_id = oldCuserId ; |
|
|
|
UPDATE wx_coupon_order SET owner_id = newCuserId WHERE owner_id = oldCuserId ; |
|
|
|
|
|
|
|
UPDATE wx_credit_history SET operator_id = newCuserId WHERE operator_type in (1,2) and operator_id = oldCuserId ; |
|
|
|
|
|
|
|
UPDATE wx_c_user_basic_info SET phone = phone + '(作废)',`status` = 1 WHERE id = oldCuserId ; |
|
|
|
|
|
|
|
IF err_flag THEN |
|
|
|
ROLLBACK; |
|
|
|
ELSE |
|
|
|
COMMIT; |
|
|
|
END IF; |
|
|
|
END |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|