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
cf93dd28
Commit
cf93dd28
authored
Feb 19, 2019
by
蘑菇🍄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverb
parent
95b4d217
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
数据组装pro.sql
jnby-reverb/数据组装pro.sql
+15
-15
No files found.
jnby-reverb/数据组装pro.sql
View file @
cf93dd28
...
...
@@ -17,14 +17,14 @@ truncate table `gic3.0`.tab_gic_member_address_copy;
truncate
table
tab_gic_mall_shopping_cart_copy
;
-- 数据填充,订单地址所在区域
update
`
order_tmp_impor
t`
.
order_import
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
update
`
tes
t`
.
order_import
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
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
)
set
A
.
area_id
=
c
.
county_id
;
-- 数据填充,收货地址所在区域
update
`
order_tmp_impor
t`
.
order_member_address
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
update
`
tes
t`
.
order_member_address
A
inner
join
(
select
county_id
,
full_name
from
`gic3.0`
.
tab_gic_county
)
c
on
(
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
...
...
@@ -55,7 +55,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f
,
-
1
as
ecommerce_buyer_id
,
IF
(
IFNULL
(
count
(
DISTINCT
s
.
unsubscribe
=
1
),
0
)
>
0
,
0
,
1
)
as
subscribe_status
,
1
as
from_erp
FROM
`
order_tmp_impor
t`
.
order_member_address
addr
FROM
`
tes
t`
.
order_member_address
addr
LEFT
JOIN
`gic3.0`
.
tab_gic_member_reverb
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
WHERE
s
.
enterprise_id
=
'ff80808164f65e7e0165140abae4125a'
...
...
@@ -102,7 +102,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f
,
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
FROM
`
order_tmp_impor
t`
.
order_import
oi
FROM
`
tes
t`
.
order_import
oi
left
join
`gic3.0`
.
tab_gic_member_reverb
members_view
on
members_view
.
card_num
=
oi
.
member_card_num
LEFT
join
(
SELECT
*
FROM
`gic3.0`
.
tab_gic_member_address
...
...
@@ -157,7 +157,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f
,
oitem
.
member_card_no
,
0
as
delivered_count
,
0
as
no_delivere_count
,
1
as
from_erp
FROM
`
order_tmp_impor
t`
.
order_item_import
oitem
`
tes
t`
.
order_item_import
oitem
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
=
'ff80808164f65e7e0165140abae4125a'
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
=
'ff80808164f65e7e0165140abae4125a'
...
...
@@ -191,7 +191,7 @@ replace INTO `tab_gic_mall_order_logistics_copy`
,
o
.
`enterprise_id`
,
o
.
`clique_id`
,
o
.
`member_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
FROM
`
order_tmp_impor
t`
.
order_logistics_import
logis
FROM
`
tes
t`
.
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_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
,
'%'
)
...
...
@@ -221,7 +221,7 @@ FROM `order_tmp_import`.order_logistics_import logis
,
logis
.
logistics_information
,
logis
.
erp_create_time
,
logis
.
erp_update_time
,
0
as
weight
,
item
.
order_item_id
,
1
as
from_erp
FROM
`
order_tmp_impor
t`
.
order_refund_logistics_import
logis
FROM
`
tes
t`
.
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_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
,
'%'
)
...
...
@@ -252,7 +252,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re
,
p
.
erp_update_time
,
0
as
reminding_times
,
o
.
`clique_id`
,
o
.
`clique_member_id`
,
1
as
from_erp
FROM
`
order_tmp_impor
t`
.
order_process_import
p
FROM
`
tes
t`
.
order_process_import
p
left
join
tab_gic_mall_order_copy
o
on
o
.
erp_order_id
=
p
.
erp_order_id
WHERE
o
.
order_id
is
not
NULL
-- and o.member_in in ('ff80808166174bfd016619bd2fbd1657','ff8080816717fc9c01671a89e80c4f17','ff80808163b2461d0163b2787ad50179' )
...
...
@@ -285,7 +285,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_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
FROM
`
order_tmp_impor
t`
.
order_refund_import
r
FROM
`
tes
t`
.
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_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_reverb
members_view
on
members_view
.
card_num
=
r
.
member_card_no
...
...
@@ -316,7 +316,7 @@ replace INTO `tab_gic_mall_order_batch_deliver_log_copy` (
,
logistics
.
logistics_company_name
,
d
.
`erp_create_time`
,
d
.
`erp_update_time`
,
d
.
`status`
,
o
.
`clique_id`
,
1
as
from_erp
from
`
order_tmp_impor
t`
.
order_batch_deliver_import
d
from
`
tes
t`
.
order_batch_deliver_import
d
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
,
'%'
)
WHERE
o
.
order_id
is
not
NULL
...
...
@@ -343,7 +343,7 @@ FROM tab_gic_mall_order_refund_copy r
;
UPDATE
`
order_tmp_impor
t`
.
order_evaluate_import
e
UPDATE
`
tes
t`
.
order_evaluate_import
e
INNER
JOIN
tab_gic_mall_pro_sku
sku
ON
e
.
mall_pro_sku_code
=
sku
.
mall_pro_sku_code
SET
e
.
mall_pro_id
=
sku
.
mall_pro_id
;
...
...
@@ -364,7 +364,7 @@ SELECT
,
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
,
itemc
.
clique_id
,
itemc
.
clique_member_id
,
e
.
member_card_no
,
NULL
AS
third_nickname
,
1
AS
from_erp
FROM
`
order_tmp_impor
t`
.
order_evaluate_import
e
FROM
`
tes
t`
.
order_evaluate_import
e
LEFT
JOIN
tab_gic_mall_order_copy
o
ON
o
.
erp_order_id
=
e
.
erp_order_id
LEFT
JOIN
tab_gic_mall_order_item_copy
itemc
ON
itemc
.
mall_pro_sku_code
=
e
.
mall_pro_sku_code
AND
itemc
.
order_id
=
o
.
order_id
group
by
e
.
id
...
...
@@ -394,7 +394,7 @@ replace INTO `tab_gic_mall_collection_copy`
,
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
,
members_view
.
clique_member_id
,
1
as
from_erp
from
`
order_tmp_impor
t`
.
collect_import
co
from
`
tes
t`
.
collect_import
co
left
join
`gic_mall`
.
tab_gic_mall_pro
pro
on
pro
.
pro_code
=
co
.
mall_pro_code
and
pro
.
enterprise_id
=
'ff80808164f65e7e0165140abae4125a'
left
join
`gic3.0`
.
tab_gic_member_reverb
members_view
on
members_view
.
card_num
=
co
.
card_no
-- WHERE co.card_no in ('WX60206813','WX60332175','WX01805426')
...
...
@@ -418,7 +418,7 @@ replace INTO `tab_gic_mall_shopping_cart_copy` (
,
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
from
`
order_tmp_impor
t`
.
mall_shoopping_cart
cart
from
`
tes
t`
.
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
=
'ff80808164f65e7e0165140abae4125a'
left
join
`gic_mall`
.
tab_gic_mall_pro_sku
sku
on
sku
.
mall_pro_sku_code
=
cart
.
mall_sku_code
and
sku
.
enterprise_id
=
'ff80808164f65e7e0165140abae4125a'
...
...
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