Commit 341c4a52 by 蘑菇🍄

init JNBY

parent 22d9f564
-- 会员信息集合
-- CREATE TABLE tab_gic_member_JNBY LIKE tab_gic_member_0;
delete from `gic3.0`.tab_gic_member_JNBY ;
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_0 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_1 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_2 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_3 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_4 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_5 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_6 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_7 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_8 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_JNBY select * from `gic3.0`.tab_gic_member_9 where enterprise_id= 'ff8080816170e2970161f626826b5990';
-- 会员信息集合
-- CREATE TABLE tab_gic_member_personal_JNBY LIKE tab_gic_member_personal_0;
delete from `gic3.0`.tab_gic_member_personal_JNBY ;
delete from `gic3.0`.tab_gic_member_personal_JNBY ;
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_0 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_1 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_2 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_3 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_4 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_5 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_6 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_7 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_8 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_personal_JNBY select * from `gic3.0`.tab_gic_member_personal_9 where enterprise_id= 'ff8080816170e2970161f626826b5990';
-- 会员信息集合
-- CREATE TABLE tab_gic_member_clerk_JNBY LIKE tab_gic_member_clerk_0;
delete from `gic3.0`.tab_gic_member_clerk_JNBY ;
delete from `gic3.0`.tab_gic_member_clerk_JNBY ;
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_0 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_1 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_2 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_3 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_4 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_5 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_6 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_7 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_8 where enterprise_id= 'ff8080816170e2970161f626826b5990';
insert into `gic3.0`.tab_gic_member_clerk_JNBY select * from `gic3.0`.tab_gic_member_clerk_9 where enterprise_id= 'ff8080816170e2970161f626826b5990';
-- 清除全部导入的数据
DELETE A FROM tab_gic_mall_order_refund_consult A
LEFT JOIN tab_gic_mall_order_refund B ON A.order_refund_id=B.order_refund_id
WHERE B.enterprise_id = 'ff8080816170e2970161f626826b5990' and A.from_erp = 1;
DELETE A FROM tab_gic_mall_order_refund_logistics A
LEFT JOIN tab_gic_mall_order_refund B ON A.mall_order_id=B.order_id
WHERE B.enterprise_id = 'ff8080816170e2970161f626826b5990' and A.from_erp = 1;
DELETE FROM tab_gic_mall_order WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_order_item WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_order_logistics WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_order_process WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_order_refund WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_collection WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_evaluate WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_order_batch_deliver_log WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM tab_gic_mall_shopping_cart WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
DELETE FROM `gic3.0`.tab_gic_member_address WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990';
-- 数据合并
insert into tab_gic_mall_order select * from `order_import_CROQUIS`.tab_gic_mall_order_copy;
insert into tab_gic_mall_order_item select * from `order_import_CROQUIS`.tab_gic_mall_order_item_copy;
insert into tab_gic_mall_order_logistics select * from `order_import_CROQUIS`.tab_gic_mall_order_logistics_copy;
insert into tab_gic_mall_order_process select * from `order_import_CROQUIS`.tab_gic_mall_order_process_copy;
insert into tab_gic_mall_order_refund_consult select * from `order_import_CROQUIS`.tab_gic_mall_order_refund_consult_copy;
insert into tab_gic_mall_order_refund select * from `order_import_CROQUIS`.tab_gic_mall_order_refund_copy;
insert into tab_gic_mall_order_refund_logistics select * from `order_import_CROQUIS`.tab_gic_mall_order_refund_logistics_copy;
insert into tab_gic_mall_collection select * from `order_import_CROQUIS`.tab_gic_mall_collection_copy;
insert into tab_gic_mall_evaluate select * from `order_import_CROQUIS`.tab_gic_mall_evaluate_copy;
insert into tab_gic_mall_order_batch_deliver_log select * from `order_import_CROQUIS`.tab_gic_mall_order_batch_deliver_log_copy;
insert into tab_gic_mall_shopping_cart select * from `order_import_CROQUIS`.tab_gic_mall_shopping_cart_copy;
insert into `gic3.0`.tab_gic_member_address select * from `gic3.0`.tab_gic_member_address_copy where enterprise_id= 'ff8080816170e2970161f626826b5990' ;
DELETE A FROM tab_gic_mall_order_batch_deliver_log A
LEFT JOIN tab_gic_mall_order B ON A.order_id=B.order_id
WHERE B.enterprise_id = 'ff8080816170e2970161f626826b5990' and B.member_id ='ff808081680f541901681309c4915322' and A.from_erp = 1;
DELETE A FROM tab_gic_mall_order_refund_consult A
LEFT JOIN tab_gic_mall_order_refund B ON A.order_refund_id=B.order_refund_id
WHERE B.enterprise_id = 'ff8080816170e2970161f626826b5990' and B.member_id ='ff808081680f541901681309c4915322' and A.from_erp = 1;
DELETE A FROM tab_gic_mall_order_refund_logistics A
LEFT JOIN tab_gic_mall_order_refund B ON A.mall_order_id=B.order_id
WHERE B.enterprise_id = 'ff8080816170e2970161f626826b5990' and B.member_id ='ff808081680f541901681309c4915322' and A.from_erp = 1;
DELETE FROM tab_gic_mall_order WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM tab_gic_mall_order_item WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM tab_gic_mall_order_logistics WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM tab_gic_mall_order_process WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM tab_gic_mall_order_refund WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM tab_gic_mall_collection WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM tab_gic_mall_evaluate WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM `gic3.0`.tab_gic_member_address WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
DELETE FROM tab_gic_mall_shopping_cart WHERE from_erp = 1 and enterprise_id= 'ff8080816170e2970161f626826b5990' and member_id ='ff808081680f541901681309c4915322';
-- 合并单个人的数据
-- WX20062935
INSERT INTO tab_gic_mall_order_item SELECT * FROM tab_gic_mall_order_item_copy WHERE member_id in ('ff808081680f541901681309c4915322');
INSERT INTO tab_gic_mall_order SELECT * FROM tab_gic_mall_order_copy WHERE member_id in ('ff808081680f541901681309c4915322');
INSERT INTO tab_gic_mall_shopping_cart SELECT * FROM tab_gic_mall_shopping_cart_copy WHERE member_id in ('ff808081680f541901681309c4915322');
INSERT INTO tab_gic_mall_collection SELECT * FROM tab_gic_mall_collection_copy WHERE member_id in ('ff808081680f541901681309c4915322');
insert into `gic3.0`.tab_gic_member_address SELECT * FROM `gic3.0`.tab_gic_member_address_copy WHERE member_id in ('ff808081680f541901681309c4915322');
insert into tab_gic_mall_evaluate SELECT * FROM tab_gic_mall_evaluate_copy WHERE member_id in ('ff808081680f541901681309c4915322');
insert into tab_gic_mall_order_logistics SELECT * FROM tab_gic_mall_order_logistics_copy WHERE member_id in ('ff808081680f541901681309c4915322');
insert into tab_gic_mall_order_refund SELECT * FROM tab_gic_mall_order_refund_copy WHERE member_id in ('ff808081680f541901681309c4915322');
insert into tab_gic_mall_order_process SELECT * FROM tab_gic_mall_order_process_copy WHERE member_id in ('ff808081680f541901681309c4915322');
INSERT INTO tab_gic_mall_order_refund_consult SELECT * FROM tab_gic_mall_order_refund_consult_copy
WHERE order_refund_id in
(
SELECT order_refund_id FROM tab_gic_mall_order_refund_copy WHERE member_id in ('ff808081680f541901681309c4915322')
);
INSERT INTO tab_gic_mall_order_refund_logistics SELECT * FROM tab_gic_mall_order_refund_logistics_copy
WHERE mall_order_id in
(
SELECT order_id FROM tab_gic_mall_order_refund_copy WHERE member_id in ('ff808081680f541901681309c4915322')
);
INSERT INTO tab_gic_mall_order_batch_deliver_log SELECT * FROM tab_gic_mall_order_batch_deliver_log_copy
WHERE order_id in
(
SELECT order_id FROM tab_gic_mall_order WHERE member_id in ('ff808081680f541901681309c4915322')
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment