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
17cd0baf
Commit
17cd0baf
authored
Jan 21, 2019
by
蘑菇🍄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`order_import_JNBY`
parent
6021f850
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
数据组装pro.sql
jnby-JNBY/数据组装pro.sql
+18
-16
No files found.
jnby-JNBY/数据组装pro.sql
View file @
17cd0baf
-- 数据填充,订单地址所在区域
-- 数据填充,订单地址所在区域
update
order_import
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
update
`order_import_JNBY`
.
order_import
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
on
on
(
locate
(
A
.
province_name
,
c
.
full_name
)
>
0
and
locate
(
A
.
city_name
,
c
.
full_name
)
>
0
and
locate
(
A
.
area_name
,
c
.
full_name
)
>
0
)
(
locate
(
A
.
province_name
,
c
.
full_name
)
>
0
and
locate
(
A
.
city_name
,
c
.
full_name
)
>
0
and
locate
(
A
.
area_name
,
c
.
full_name
)
>
0
)
set
A
.
area_id
=
c
.
county_id
set
A
.
area_id
=
c
.
county_id
;
;
-- 数据填充,收货地址所在区域
-- 数据填充,收货地址所在区域
update
order_member_address
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
update
`order_import_JNBY`
.
order_member_address
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
on
on
(
locate
(
A
.
province
,
c
.
full_name
)
>
0
and
locate
(
A
.
city
,
c
.
full_name
)
>
0
and
locate
(
A
.
area
,
c
.
full_name
)
>
0
)
(
locate
(
A
.
province
,
c
.
full_name
)
>
0
and
locate
(
A
.
city
,
c
.
full_name
)
>
0
and
locate
(
A
.
area
,
c
.
full_name
)
>
0
)
set
A
.
county_id
=
c
.
county_id
set
A
.
county_id
=
c
.
county_id
...
@@ -39,7 +39,7 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
...
@@ -39,7 +39,7 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
,
-
1
as
ecommerce_buyer_id
,
IF
(
IFNULL
(
count
(
DISTINCT
s
.
unsubscribe
=
1
),
0
)
>
0
,
0
,
1
)
as
subscribe_status
,
-
1
as
ecommerce_buyer_id
,
IF
(
IFNULL
(
count
(
DISTINCT
s
.
unsubscribe
=
1
),
0
)
>
0
,
0
,
1
)
as
subscribe_status
,
1
as
from_erp
,
1
as
from_erp
FROM
order_member_address
addr
FROM
`order_import_JNBY`
.
order_member_address
addr
LEFT
JOIN
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
addr
.
member_number
LEFT
JOIN
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
addr
.
member_number
LEFT
JOIN
`gic3.0`
.
tab_gic_member_sms
s
on
s
.
phone_number
=
addr
.
buyer_moile
LEFT
JOIN
`gic3.0`
.
tab_gic_member_sms
s
on
s
.
phone_number
=
addr
.
buyer_moile
WHERE
s
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
WHERE
s
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
...
@@ -85,7 +85,7 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
...
@@ -85,7 +85,7 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
,
oi
.
store_code
,
oi
.
clerk_code
,
null
as
trade_close_reason
,
'version_1.0'
as
order_version
,
oi
.
store_code
,
oi
.
clerk_code
,
null
as
trade_close_reason
,
'version_1.0'
as
order_version
,
1
as
from_erp
,
null
as
order_sequence
,
1
as
from_erp
,
null
as
order_sequence
FROM
order_import
oi
FROM
`order_import_JNBY`
.
order_import
oi
left
join
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
oi
.
member_card_num
left
join
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
oi
.
member_card_num
LEFT
join
(
LEFT
join
(
SELECT
*
FROM
`gic3.0`
.
tab_gic_member_address
SELECT
*
FROM
`gic3.0`
.
tab_gic_member_address
...
@@ -139,7 +139,8 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
...
@@ -139,7 +139,8 @@ update order_import A inner join(select county_id,full_name from `gic3.0`.tab_gi
,
pro
.
pro_code
,
oitem
.
order_item_number
,
pro
.
brand_code
,
pro
.
pro_code
,
oitem
.
order_item_number
,
pro
.
brand_code
,
oitem
.
member_card_no
,
0
as
delivered_count
,
0
as
no_delivere_count
,
1
as
from_erp
,
oitem
.
member_card_no
,
0
as
delivered_count
,
0
as
no_delivere_count
,
1
as
from_erp
FROM
order_item_import
oitem
FROM
`order_import_JNBY`
.
order_item_import
oitem
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
oitem
.
erp_order_id
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
oitem
.
erp_order_id
left
join
`gic_mall`
.
tab_gic_mall_pro
pro
on
pro
.
pro_code
=
oitem
.
mall_pro_code
and
pro
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic_mall`
.
tab_gic_mall_pro
pro
on
pro
.
pro_code
=
oitem
.
mall_pro_code
and
pro
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic_mall`
.
tab_gic_mall_pro_sku
sku
on
sku
.
mall_pro_sku_code
=
oitem
.
mall_pro_sku_code
and
sku
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic_mall`
.
tab_gic_mall_pro_sku
sku
on
sku
.
mall_pro_sku_code
=
oitem
.
mall_pro_sku_code
and
sku
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
...
@@ -173,7 +174,7 @@ INSERT INTO `tab_gic_mall_order_logistics_copy`
...
@@ -173,7 +174,7 @@ INSERT INTO `tab_gic_mall_order_logistics_copy`
,
o
.
`enterprise_id`
,
o
.
`clique_id`
,
o
.
`member_id`
,
o
.
`enterprise_id`
,
o
.
`clique_id`
,
o
.
`member_id`
,
o
.
`clique_member_id`
,
0
as
weight
,
item
.
order_item_id
,
o
.
`clique_member_id`
,
0
as
weight
,
item
.
order_item_id
,
logis
.
send_num
,
IFNULL
(
item
.
mall_pro_number
,
0
)
as
`order_item_sum_num`
,
1
as
from_erp
,
logis
.
send_num
,
IFNULL
(
item
.
mall_pro_number
,
0
)
as
`order_item_sum_num`
,
1
as
from_erp
FROM
order_logistics_import
logis
FROM
`order_import_JNBY`
.
order_logistics_import
logis
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
logis
.
erp_order_id
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
logis
.
erp_order_id
left
join
tab_gic_mall_order_item_copy
item
on
item
.
pro_code
=
logis
.
mall_pro_code
left
join
tab_gic_mall_order_item_copy
item
on
item
.
pro_code
=
logis
.
mall_pro_code
left
join
`gic3.0`
.
tab_gic_logistics_company
logistics
on
logis
.
logistics_company_name
LIKE
CONCAT
(
'%'
,
logistics
.
logistics_company_name
,
'%'
)
left
join
`gic3.0`
.
tab_gic_logistics_company
logistics
on
logis
.
logistics_company_name
LIKE
CONCAT
(
'%'
,
logistics
.
logistics_company_name
,
'%'
)
...
@@ -181,9 +182,9 @@ FROM order_logistics_import logis
...
@@ -181,9 +182,9 @@ FROM order_logistics_import logis
;
;
-- 把字符串【courierNumber】替换成正则的物流单号
-- 把字符串【courierNumber】替换成正则的物流单号
UPDATE
`tab_gic_mall_order_logistics_copy`
SET
logistics_information
=
replace
(
logistics_information
,
'courierNumber'
,
courier_number
);
UPDATE
`tab_gic_mall_order_logistics_copy`
SET
logistics_information
=
replace
(
logistics_information
,
'courierNumber'
,
courier_number
);
-- 把字符串【logisticsCompanyCode】替换成正则的物流公司编号
-- 把字符串【logisticsCompanyCode】替换成正则的物流公司编号
UPDATE
`tab_gic_mall_order_logistics_copy`
SET
logistics_information
=
replace
(
logistics_information
,
'logisticsCompanyCode'
,
logistics_company_code
);
UPDATE
`tab_gic_mall_order_logistics_copy`
SET
logistics_information
=
replace
(
logistics_information
,
'logisticsCompanyCode'
,
logistics_company_code
);
...
@@ -203,7 +204,7 @@ FROM order_logistics_import logis
...
@@ -203,7 +204,7 @@ FROM order_logistics_import logis
,
logis
.
logistics_information
,
logis
.
erp_create_time
,
logis
.
erp_update_time
,
logis
.
logistics_information
,
logis
.
erp_create_time
,
logis
.
erp_update_time
,
0
as
weight
,
item
.
order_item_id
,
1
as
from_erp
,
0
as
weight
,
item
.
order_item_id
,
1
as
from_erp
FROM
order_refund_logistics_import
logis
FROM
`order_import_JNBY`
.
order_refund_logistics_import
logis
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
logis
.
erp_order_id
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
logis
.
erp_order_id
left
join
tab_gic_mall_order_item_copy
item
on
item
.
pro_code
=
logis
.
mall_pro_code
left
join
tab_gic_mall_order_item_copy
item
on
item
.
pro_code
=
logis
.
mall_pro_code
left
join
`gic3.0`
.
tab_gic_logistics_company
logistics
on
logis
.
logistics_company_name
LIKE
CONCAT
(
'%'
,
logistics
.
logistics_company_name
,
'%'
)
left
join
`gic3.0`
.
tab_gic_logistics_company
logistics
on
logis
.
logistics_company_name
LIKE
CONCAT
(
'%'
,
logistics
.
logistics_company_name
,
'%'
)
...
@@ -234,7 +235,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re
...
@@ -234,7 +235,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re
,
p
.
erp_update_time
,
0
as
reminding_times
,
o
.
`clique_id`
,
p
.
erp_update_time
,
0
as
reminding_times
,
o
.
`clique_id`
,
o
.
`clique_member_id`
,
1
as
from_erp
,
o
.
`clique_member_id`
,
1
as
from_erp
FROM
order_process_import
p
FROM
`order_import_JNBY`
.
order_process_import
p
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
p
.
erp_order_id
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
p
.
erp_order_id
WHERE
o
.
order_id
is
not
NULL
WHERE
o
.
order_id
is
not
NULL
-- and o.member_in in ('ff80808166174bfd016619bd2fbd1657','ff8080816717fc9c01671a89e80c4f17','ff80808163b2461d0163b2787ad50179' )
-- and o.member_in in ('ff80808166174bfd016619bd2fbd1657','ff8080816717fc9c01671a89e80c4f17','ff80808163b2461d0163b2787ad50179' )
...
@@ -267,7 +268,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re
...
@@ -267,7 +268,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re
,
r
.
refund_type
,
null
as
refund_logistics_id
,
r
.
order_item_num
,
r
.
order_item_sum_num
,
SUM
(
item
.
mall_pro_number
)
as
order_num
,
r
.
refund_type
,
null
as
refund_logistics_id
,
r
.
order_item_num
,
r
.
order_item_sum_num
,
SUM
(
item
.
mall_pro_number
)
as
order_num
,
r
.
refund_deliver_type
,
null
as
refund_seller_address_id
,
null
as
refund_seller_desc
,
r
.
refund_deliver_type
,
null
as
refund_seller_address_id
,
null
as
refund_seller_desc
,
null
as
refund_process_time
,
null
as
refund_goods_time
,
o
.
order_number
as
doc_no
,
1
as
from_erp
,
null
as
refund_process_time
,
null
as
refund_goods_time
,
o
.
order_number
as
doc_no
,
1
as
from_erp
FROM
order_refund_import
r
FROM
`order_import_JNBY`
.
order_refund_import
r
left
join
tab_gic_mall_order_copy
o
on
o
.
order_number
=
r
.
out_trade_no
left
join
tab_gic_mall_order_copy
o
on
o
.
order_number
=
r
.
out_trade_no
left
join
tab_gic_mall_order_item_copy
item
on
item
.
order_id
=
o
.
order_id
and
r
.
apply_refund_price
=
item
.
pay_amount
left
join
tab_gic_mall_order_item_copy
item
on
item
.
order_id
=
o
.
order_id
and
r
.
apply_refund_price
=
item
.
pay_amount
left
join
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
r
.
member_card_no
left
join
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
r
.
member_card_no
...
@@ -298,7 +299,7 @@ INSERT INTO `tab_gic_mall_order_batch_deliver_log_copy` (
...
@@ -298,7 +299,7 @@ INSERT INTO `tab_gic_mall_order_batch_deliver_log_copy` (
,
logistics
.
logistics_company_name
,
d
.
`erp_create_time`
,
d
.
`erp_update_time`
,
logistics
.
logistics_company_name
,
d
.
`erp_create_time`
,
d
.
`erp_update_time`
,
d
.
`status`
,
o
.
`clique_id`
,
1
as
from_erp
,
d
.
`status`
,
o
.
`clique_id`
,
1
as
from_erp
from
order_batch_deliver_import
d
from
`order_import_JNBY`
.
order_batch_deliver_import
d
left
join
tab_gic_mall_order_copy
o
on
o
.
order_number
=
d
.
order_number
left
join
tab_gic_mall_order_copy
o
on
o
.
order_number
=
d
.
order_number
left
join
`gic3.0`
.
tab_gic_logistics_company
logistics
on
d
.
logistics_company_name
LIKE
CONCAT
(
'%'
,
logistics
.
logistics_company_name
,
'%'
)
left
join
`gic3.0`
.
tab_gic_logistics_company
logistics
on
d
.
logistics_company_name
LIKE
CONCAT
(
'%'
,
logistics
.
logistics_company_name
,
'%'
)
WHERE
o
.
order_id
is
not
NULL
WHERE
o
.
order_id
is
not
NULL
...
@@ -341,7 +342,7 @@ SELECT
...
@@ -341,7 +342,7 @@ SELECT
,
e
.
evaluate_score
,
e
.
show_status
,
e
.
status
,
e
.
reply_content
,
e
.
evaluate_score
,
e
.
show_status
,
e
.
status
,
e
.
reply_content
,
e
.
reply_status
,
e
.
reply_date
,
e
.
erp_create_time
,
null
as
update_time
,
e
.
reply_status
,
e
.
reply_date
,
e
.
erp_create_time
,
null
as
update_time
,
personal
.
clique_id
,
personal
.
clique_member_id
,
e
.
member_card_no
,
personal
.
member_name
,
1
as
from_erp
,
personal
.
clique_id
,
personal
.
clique_member_id
,
e
.
member_card_no
,
personal
.
member_name
,
1
as
from_erp
FROM
order_evaluate_import
e
FROM
`order_import_JNBY`
.
order_evaluate_import
e
left
join
tab_gic_mall_order_item_copy
itemc
on
itemc
.
pro_code
=
e
.
mall_pro_code
left
join
tab_gic_mall_order_item_copy
itemc
on
itemc
.
pro_code
=
e
.
mall_pro_code
left
join
`gic3.0`
.
tab_gic_member_personal_JNBY
personal
on
personal
.
member_id
=
itemc
.
member_id
left
join
`gic3.0`
.
tab_gic_member_personal_JNBY
personal
on
personal
.
member_id
=
itemc
.
member_id
-- WHERE e.member_card_no in ('WX60206813','WX60332175','WX01805426')
-- WHERE e.member_card_no in ('WX60206813','WX60332175','WX01805426')
...
@@ -365,7 +366,7 @@ INSERT INTO `tab_gic_mall_collection_copy`
...
@@ -365,7 +366,7 @@ INSERT INTO `tab_gic_mall_collection_copy`
,
pro
.
mall_pro_image_url
,
pro
.
mall_pro_spu_price
,
co
.
`status`
,
pro
.
mall_pro_image_url
,
pro
.
mall_pro_spu_price
,
co
.
`status`
,
co
.
erp_create_time
,
co
.
erp_create_time
as
update_time
,
members_view
.
clique_id
,
co
.
erp_create_time
,
co
.
erp_create_time
as
update_time
,
members_view
.
clique_id
,
members_view
.
clique_member_id
,
1
as
from_erp
,
members_view
.
clique_member_id
,
1
as
from_erp
from
collect_import
co
from
`order_import_JNBY`
.
collect_import
co
left
join
`gic_mall`
.
tab_gic_mall_pro
pro
on
pro
.
pro_code
=
co
.
mall_pro_code
and
pro
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic_mall`
.
tab_gic_mall_pro
pro
on
pro
.
pro_code
=
co
.
mall_pro_code
and
pro
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
co
.
card_no
left
join
`gic3.0`
.
tab_gic_member_JNBY
members_view
on
members_view
.
card_num
=
co
.
card_no
-- WHERE co.card_no in ('WX60206813','WX60332175','WX01805426')
-- WHERE co.card_no in ('WX60206813','WX60332175','WX01805426')
...
@@ -388,7 +389,8 @@ INSERT INTO `tab_gic_mall_shopping_cart_copy` (
...
@@ -388,7 +389,8 @@ INSERT INTO `tab_gic_mall_shopping_cart_copy` (
,
cart
.
mall_pro_price
,
pro
.
mall_pro_image_url
,
cart
.
mall_pro_number
,
sku
.
mall_pro_sku_price
,
cart
.
mall_pro_price
,
pro
.
mall_pro_image_url
,
cart
.
mall_pro_number
,
sku
.
mall_pro_sku_price
,
cart
.
mall_pro_summary_price
as
mall_pro_payable_price
,
IF
(
isnull
(
pro
.
mall_pro_id
),
0
,
1
)
as
status
,
cart
.
erp_create_time
,
cart
.
erp_create_time
as
update_time
,
cart
.
mall_pro_summary_price
as
mall_pro_payable_price
,
IF
(
isnull
(
pro
.
mall_pro_id
),
0
,
1
)
as
status
,
cart
.
erp_create_time
,
cart
.
erp_create_time
as
update_time
,
cart
.
mall_pro_summary_price
,
members_view
.
clique_id
,
members_view
.
clique_member_id
,
1
as
from_erp
,
cart
.
mall_pro_summary_price
,
members_view
.
clique_id
,
members_view
.
clique_member_id
,
1
as
from_erp
from
mall_shoopping_cart
cart
from
`order_import_JNBY`
.
mall_shoopping_cart
cart
left
join
`gic_mall`
.
tab_gic_mall_pro
pro
on
pro
.
pro_code
=
cart
.
mall_pro_code
and
pro
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic_mall`
.
tab_gic_mall_pro
pro
on
pro
.
pro_code
=
cart
.
mall_pro_code
and
pro
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic_mall`
.
tab_gic_mall_pro_sku
sku
on
sku
.
mall_pro_sku_code
=
cart
.
mall_sku_code
and
sku
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
left
join
`gic_mall`
.
tab_gic_mall_pro_sku
sku
on
sku
.
mall_pro_sku_code
=
cart
.
mall_sku_code
and
sku
.
enterprise_id
=
'ff8080816170e2970161f626826b5990'
...
...
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