Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
script
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚闰伍
script
Commits
258c744c
Commit
258c744c
authored
Dec 06, 2018
by
蘑菇🍄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
清理,order_step 判断
parent
7e3a802c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
54 deletions
+101
-54
合并清理.sql
jnby-pomme/合并清理.sql
+26
-33
导入指定的会员.sql
jnby-pomme/导入指定的会员.sql
+48
-17
数据组装pro.sql
jnby-pomme/数据组装pro.sql
+8
-4
清理中间库导入表.sql
jnby-pomme/清理中间库导入表.sql
+19
-0
No files found.
jnby-pomme/合并清理.sql
View file @
258c744c
-- 数据合并
-- 清除全部导入的数据
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
=
'ff8080816170e8990161f6736b4c6033'
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
=
'ff8080816170e8990161f6736b4c6033'
and
A
.
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_order_item
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_order_logistics
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_order_process
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_order_refund
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_collection
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_evaluate
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_order_batch_deliver_log
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
`gic3.0`
.
tab_gic_member_address
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
DELETE
FROM
tab_gic_mall_shopping_cart
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
;
-- 数据合并
-- 数据合并
insert
into
tab_gic_mall_order
select
*
from
tab_gic_mall_order_copy
;
insert
into
tab_gic_mall_order
select
*
from
tab_gic_mall_order_copy
;
insert
into
tab_gic_mall_order_item
select
*
from
tab_gic_mall_order_item_copy
;
insert
into
tab_gic_mall_order_item
select
*
from
tab_gic_mall_order_item_copy
;
...
@@ -13,42 +38,10 @@ insert into tab_gic_mall_shopping_cart select * from tab_gic_mall_shop
...
@@ -13,42 +38,10 @@ insert into tab_gic_mall_shopping_cart select * from tab_gic_mall_shop
insert
into
`gic3.0`
.
tab_gic_member_address
select
*
from
`gic3.0`
.
tab_gic_member_address_copy
;
insert
into
`gic3.0`
.
tab_gic_member_address
select
*
from
`gic3.0`
.
tab_gic_member_address_copy
;
-- 清空中间表
DELETE
FROM
order_import
;
DELETE
FROM
order_item_import
;
DELETE
FROM
collect_import
;
DELETE
FROM
order_batch_deliver_import
;
DELETE
FROM
order_logistics_import
;
DELETE
FROM
order_process_import
;
DELETE
FROM
order_refund_import
;
DELETE
FROM
order_refund_logistics_import
;
DELETE
FROM
order_evaluate_import
;
DELETE
FROM
order_member_address
;
DELETE
FROM
mall_shoopping_cart
;
-- 清除全部导入的数据
DELETE
FROM
tab_gic_mall_order
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_item
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_logistics
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_process
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_refund_consult
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_refund
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_refund_logistics
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_collection
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_evaluate
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_batch_deliver_log
WHERE
from_erp
=
1
;
DELETE
FROM
`gic3.0`
.
tab_gic_member_address
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_shopping_cart
WHERE
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order
WHERE
member_id
=
'ff808081671d4dd501673a76508d32ce'
AND
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order_item
WHERE
member_id
=
'ff808081671d4dd501673a76508d32ce'
AND
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
from_erp
=
1
;
...
...
jnby-pomme/导入指定的会员.sql
View file @
258c744c
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
=
'ff8080816170e8990161f6736b4c6033'
and
B
.
member_id
=
'ff808081671d4dd501673a76508d32ce'
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
=
'ff8080816170e8990161f6736b4c6033'
and
B
.
member_id
=
'ff808081671d4dd501673a76508d32ce'
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
=
'ff8080816170e8990161f6736b4c6033'
and
B
.
member_id
=
'ff808081671d4dd501673a76508d32ce'
and
A
.
from_erp
=
1
;
DELETE
FROM
tab_gic_mall_order
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
tab_gic_mall_order_item
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
tab_gic_mall_order_logistics
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
tab_gic_mall_order_process
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
tab_gic_mall_order_refund
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
tab_gic_mall_collection
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
tab_gic_mall_evaluate
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
`gic3.0`
.
tab_gic_member_address
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
DELETE
FROM
tab_gic_mall_shopping_cart
WHERE
from_erp
=
1
and
enterprise_id
=
'ff8080816170e8990161f6736b4c6033'
and
member_id
=
'ff808081671d4dd501673a76508d32ce'
;
-- 合并单个人的数据
-- 合并单个人的数据
-- WX20023230
-- WX20067966
-- WX20062589
-- WX20062935
-- WX20062935
INSERT
INTO
tab_gic_mall_order_item
SELECT
*
FROM
tab_gic_mall_order_item_copy
WHERE
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_order_item
SELECT
*
FROM
tab_gic_mall_order_item_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_order
SELECT
*
FROM
tab_gic_mall_order_copy
WHERE
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_order
SELECT
*
FROM
tab_gic_mall_order_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_shopping_cart
SELECT
*
FROM
tab_gic_mall_shopping_cart_copy
WHERE
member_id
in
(
'ff8080816
5b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff8080816
73c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_shopping_cart
SELECT
*
FROM
tab_gic_mall_shopping_cart_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_collection
SELECT
*
FROM
tab_gic_mall_collection_copy
WHERE
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_collection
SELECT
*
FROM
tab_gic_mall_collection_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
insert
into
`gic3.0`
.
tab_gic_member_address
SELECT
*
from
`gic3.0`
.
tab_gic_member_address_copy
WHERE
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
insert
into
`gic3.0`
.
tab_gic_member_address
SELECT
*
FROM
`gic3.0`
.
tab_gic_member_address_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_evaluate
SELECT
*
from
tab_gic_mall_evaluate_copy
where
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_evaluate
SELECT
*
FROM
tab_gic_mall_evaluate_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_order_logistics
SELECT
*
from
tab_gic_mall_order_logistics_copy
where
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_order_logistics
SELECT
*
FROM
tab_gic_mall_order_logistics_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_order_refund
SELECT
*
from
tab_gic_mall_order_refund_copy
where
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_order_refund
SELECT
*
FROM
tab_gic_mall_order_refund_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_order_process
SELECT
*
from
tab_gic_mall_order_process_copy
WHERE
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
);
insert
into
tab_gic_mall_order_process
SELECT
*
FROM
tab_gic_mall_order_process_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
);
INSERT
INTO
tab_gic_mall_order_refund_consult
SELECT
*
from
tab_gic_mall_order_refund_consult_copy
INSERT
INTO
tab_gic_mall_order_refund_consult
SELECT
*
FROM
tab_gic_mall_order_refund_consult_copy
WHERE
order_refund_id
in
WHERE
order_refund_id
in
(
(
SELECT
order_refund_id
from
tab_gic_mall_order_refund_copy
where
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
)
SELECT
order_refund_id
FROM
tab_gic_mall_order_refund_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
)
);
);
INSERT
INTO
tab_gic_mall_order_refund_logistics
SELECT
*
from
tab_gic_mall_order_refund_logistics_copy
INSERT
INTO
tab_gic_mall_order_refund_logistics
SELECT
*
FROM
tab_gic_mall_order_refund_logistics_copy
WHERE
mall_order_id
in
WHERE
mall_order_id
in
(
(
SELECT
order_id
from
tab_gic_mall_order_refund_copy
where
member_id
in
(
'ff80808165b4c5070165c20bbe331701'
,
'ff8080816760187701676375222d32e1'
,
'ff808081671d4dd501673a76508d32ce'
,
'ff808081673c614601673ed9718f3366'
)
SELECT
order_id
FROM
tab_gic_mall_order_refund_copy
WHERE
member_id
in
(
'ff808081673c614601673ed9718f3366'
)
);
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
(
'ff808081673c614601673ed9718f3366'
)
);
);
jnby-pomme/数据组装pro.sql
View file @
258c744c
...
@@ -69,13 +69,15 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
...
@@ -69,13 +69,15 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
(
(
`order_id`
,
`erp_order_id`
`order_id`
,
`erp_order_id`
,
`order_number`
,
`order_number`
,
`order_process_id`
,
`order_step`
,
`enterprise_id`
,
`brand_id`
,
`member_id`
,
`mall_pro_all_price`
,
`enterprise_id`
,
`brand_id`
,
`member_id`
,
`mall_pro_all_price`
,
`actual_freight`
,
`mall_order_freight`
,
`discount_amount`
,
`discount_amount_info`
,
`actual_freight`
,
`mall_order_freight`
,
`discount_amount`
,
`discount_amount_info`
,
`amount_payable_info`
,
`pay_amount`
,
`pay_type`
,
`coupon_card_log_id`
,
`amount_payable_info`
,
`pay_amount`
,
`pay_type`
,
`coupon_card_log_id`
,
`coupon_card_code`
,
`get_points`
,
`use_points`
,
`clerk_id`
,
`coupon_card_code`
,
`get_points`
,
`use_points`
,
`clerk_id`
,
`store_id`
,
`address_id`
,
`address_info`
,
`area_id`
,
`store_id`
,
`address_id`
,
`address_info`
,
`area_id`
,
`buyer_name`
,
`buyer_phone`
,
`logistics_company_id`
,
`logistics_number`
,
`buyer_name`
,
`buyer_phone`
,
`logistics_company_id`
,
`logistics_number`
,
`order_process_id`
,
`order_step`
,
`pay_number`
,
`pay_time`
,
`pay_number`
,
`pay_time`
,
`order_show`
,
`evaluation_status`
,
`new_status`
,
`remarks`
,
`order_show`
,
`evaluation_status`
,
`new_status`
,
`remarks`
,
`create_time`
,
`update_time`
,
`pay_amount_all`
,
`stock_decrease`
,
`create_time`
,
`update_time`
,
`pay_amount_all`
,
`stock_decrease`
,
`clique_id`
,
`clique_member_id`
,
`deliver_store_id`
,
`delivery_type`
,
`clique_id`
,
`clique_member_id`
,
`deliver_store_id`
,
`delivery_type`
...
@@ -85,13 +87,15 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
...
@@ -85,13 +87,15 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
select
select
replace
(
uuid
(),
'-'
,
''
)
as
order_id
,
oi
.
erp_order_id
replace
(
uuid
(),
'-'
,
''
)
as
order_id
,
oi
.
erp_order_id
,
IFNULL
(
oi
.
order_number
,
CONCAT
(
'RE999'
,
floor
(
UNIX_TIMESTAMP
(
oi
.
create_time
))))
as
order_number
,
IFNULL
(
oi
.
order_number
,
CONCAT
(
'RE999'
,
floor
(
UNIX_TIMESTAMP
(
oi
.
create_time
))))
as
order_number
,
replace
(
uuid
(),
'-'
,
''
)
as
order_process_id
,
IF
(
oi
.
create_time
<
(
date_sub
(
now
()
,
interval
3
day
)),
0
,
oi
.
order_step
)
as
order_step
,
members_view
.
enterprise_id
,
'-1'
as
brand_id
,
members_view
.
member_id
,
oi
.
mall_pro_all_price
,
members_view
.
enterprise_id
,
'-1'
as
brand_id
,
members_view
.
member_id
,
oi
.
mall_pro_all_price
,
oi
.
actual_freight
,
oi
.
actual_freight
as
mall_order_freight
,
oi
.
discount_amount
,
oi
.
discount_amount_info
,
oi
.
actual_freight
,
oi
.
actual_freight
as
mall_order_freight
,
oi
.
discount_amount
,
oi
.
discount_amount_info
,
oi
.
amount_payable_info
,
oi
.
pay_amount
,
oi
.
pay_type
,
null
as
coupon_card_log_id
,
oi
.
amount_payable_info
,
oi
.
pay_amount
,
oi
.
pay_type
,
null
as
coupon_card_log_id
,
oi
.
coupon_card_code
,
oi
.
get_points
,
oi
.
use_points
,
clerk
.
clerk_id
,
oi
.
coupon_card_code
,
oi
.
get_points
,
oi
.
use_points
,
clerk
.
clerk_id
,
clerk
.
store_id_order
as
store_id
,
addr
.
member_address_id
,
oi
.
address_info
,
addr
.
county_id
as
area_id
,
clerk
.
store_id_order
as
store_id
,
addr
.
member_address_id
,
oi
.
address_info
,
addr
.
county_id
as
area_id
,
oi
.
buyer_name
,
oi
.
buyer_phone
,
logistics
.
`logistics_company_id`
,
oi
.
logistics_number
,
oi
.
buyer_name
,
oi
.
buyer_phone
,
logistics
.
`logistics_company_id`
,
oi
.
logistics_number
,
replace
(
uuid
(),
'-'
,
''
)
as
order_process_id
,
oi
.
order_step
,
oi
.
pay_number
,
oi
.
pay_time
,
oi
.
pay_number
,
oi
.
pay_time
,
oi
.
order_show
,
oi
.
evaluation_status
,
oi
.
new_status
,
oi
.
remarks
,
oi
.
order_show
,
oi
.
evaluation_status
,
oi
.
new_status
,
oi
.
remarks
,
oi
.
create_time
,
oi
.
create_time
as
update_time
,
oi
.
pay_amount_all
,
oi
.
stock_decrease
,
oi
.
create_time
,
oi
.
create_time
as
update_time
,
oi
.
pay_amount_all
,
oi
.
stock_decrease
,
members_view
.
clique_id
,
members_view
.
clique_member_id
,
null
as
deliver_store_id
,
0
as
delivery_type
,
members_view
.
clique_id
,
members_view
.
clique_member_id
,
null
as
deliver_store_id
,
0
as
delivery_type
...
...
jnby-pomme/清理中间库导入表.sql
0 → 100644
View file @
258c744c
-- 清空中间表
DELETE
FROM
order_import
;
DELETE
FROM
order_item_import
;
DELETE
FROM
collect_import
;
DELETE
FROM
order_batch_deliver_import
;
DELETE
FROM
order_logistics_import
;
DELETE
FROM
order_process_import
;
DELETE
FROM
order_refund_import
;
DELETE
FROM
order_refund_logistics_import
;
DELETE
FROM
order_evaluate_import
;
DELETE
FROM
order_member_address
;
DELETE
FROM
mall_shoopping_cart
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment