Commit b750afd8 by zhangyannao

Update 数据组装pro.sql

parent f75a981a
-- 清除导入的临时数据 -- 清除导入的临时数据
truncate from tab_gic_mall_order_copy ; truncate table tab_gic_mall_order_copy ;
truncate from tab_gic_mall_order_item_copy ; truncate table tab_gic_mall_order_item_copy ;
truncate from tab_gic_mall_order_logistics_copy ; truncate table tab_gic_mall_order_logistics_copy ;
truncate from tab_gic_mall_order_process_copy ; truncate table tab_gic_mall_order_process_copy ;
truncate from tab_gic_mall_order_refund_consult_copy ; truncate table tab_gic_mall_order_refund_consult_copy ;
truncate from tab_gic_mall_order_refund_copy ; truncate table tab_gic_mall_order_refund_copy ;
truncate from tab_gic_mall_order_refund_logistics_copy ; truncate table tab_gic_mall_order_refund_logistics_copy ;
truncate from tab_gic_mall_collection_copy ; truncate table tab_gic_mall_collection_copy ;
truncate from tab_gic_mall_evaluate_copy ; truncate table tab_gic_mall_evaluate_copy ;
truncate from tab_gic_mall_order_batch_deliver_log_copy ; truncate table tab_gic_mall_order_batch_deliver_log_copy ;
truncate from `gic3.0`.tab_gic_member_address_copy; truncate table `gic3.0`.tab_gic_member_address_copy;
truncate from tab_gic_mall_shopping_cart_copy; truncate table tab_gic_mall_shopping_cart_copy;
-- 数据填充,订单地址所在区域 -- 数据填充,订单地址所在区域
update `order_tmp_import`.order_import A inner join(select county_id,full_name from `gic3.0`.tab_gic_county ) c update `order_tmp_import`.order_import A inner join(select county_id,full_name from `gic3.0`.tab_gic_county ) c
...@@ -34,7 +34,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f ...@@ -34,7 +34,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f
-- isdefault=Y 则为默认地址 -- isdefault=Y 则为默认地址
-- 地址表 退订状态 1:未退订,0:退订 , -- 地址表 退订状态 1:未退订,0:退订 ,
-- tab_gic_member_sms 营销短信是否退订:1.退订 -- tab_gic_member_sms 营销短信是否退订:1.退订
INSERT INTO `gic3.0`.`tab_gic_member_address_copy` replace INTO `gic3.0`.`tab_gic_member_address_copy`
( (
`member_address_id` , `member_id` , `member_personal_id` `member_address_id` , `member_id` , `member_personal_id`
, `is_default` , `address_type` , `address` , `is_default` , `address_type` , `address`
...@@ -64,7 +64,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f ...@@ -64,7 +64,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f
-- 把订单信息写入临时表【tab_gic_mall_order_copy】 -- 把订单信息写入临时表【tab_gic_mall_order_copy】
INSERT INTO `tab_gic_mall_order_copy` replace INTO `tab_gic_mall_order_copy`
( (
`order_id`,`erp_order_id` `order_id`,`erp_order_id`
, `order_number` , `order_number`
...@@ -121,7 +121,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f ...@@ -121,7 +121,7 @@ update `order_tmp_import`.order_import A inner join(select county_id,full_name f
-- 把订单项写入导临时表【tab_gic_mall_order_item_copy】 -- 把订单项写入导临时表【tab_gic_mall_order_item_copy】
INSERT INTO `tab_gic_mall_order_item_copy` replace INTO `tab_gic_mall_order_item_copy`
( (
`order_item_id` `order_item_id`
, `order_id` , `enterprise_id` , `brand_id` , `order_id` , `enterprise_id` , `brand_id`
...@@ -174,7 +174,7 @@ FROM ...@@ -174,7 +174,7 @@ FROM
-- 4已确认交易结束,5已发货订单项退款中,6待付款订单项退款中,7部分发货', -- 4已确认交易结束,5已发货订单项退款中,6待付款订单项退款中,7部分发货',
-- 把发货的物流信息写入导临时表【tab_gic_mall_order_logistics_copy】 -- 把发货的物流信息写入导临时表【tab_gic_mall_order_logistics_copy】
INSERT INTO `tab_gic_mall_order_logistics_copy` replace INTO `tab_gic_mall_order_logistics_copy`
( (
`mall_order_logistics_id` , `mall_order_id` , `logistics_company_id` `mall_order_logistics_id` , `mall_order_id` , `logistics_company_id`
, `logistics_company_name` , `logistics_company_code`, `courier_number` , `logistics_company_name` , `logistics_company_code`, `courier_number`
...@@ -208,7 +208,7 @@ FROM `order_tmp_import`.order_logistics_import logis ...@@ -208,7 +208,7 @@ FROM `order_tmp_import`.order_logistics_import logis
-- 把退款的物流信息写入导临时表【tab_gic_mall_order_refund_logistics_copy】 -- 把退款的物流信息写入导临时表【tab_gic_mall_order_refund_logistics_copy】
INSERT INTO `tab_gic_mall_order_refund_logistics_copy` replace INTO `tab_gic_mall_order_refund_logistics_copy`
( (
`mall_order_logistics_id`, `mall_order_id` , `logistics_company_id` `mall_order_logistics_id`, `mall_order_id` , `logistics_company_id`
, `logistics_company_name` , `logistics_company_code` , `courier_number` , `logistics_company_name` , `logistics_company_code` , `courier_number`
...@@ -236,7 +236,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re ...@@ -236,7 +236,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re
-- 把订单处理流程写入临时表【tab_gic_mall_order_process_copy】 -- 把订单处理流程写入临时表【tab_gic_mall_order_process_copy】
INSERT INTO `tab_gic_mall_order_process_copy` replace INTO `tab_gic_mall_order_process_copy`
( (
`order_process_id` , `order_id` , `enterprise_id` `order_process_id` , `order_id` , `enterprise_id`
, `brand_id` , `member_id` , `order_step` , `brand_id` , `member_id` , `order_step`
...@@ -262,7 +262,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re ...@@ -262,7 +262,7 @@ UPDATE `tab_gic_mall_order_refund_logistics_copy` SET logistics_information = re
-- 把订单退款申请写入临时表【tab_gic_mall_order_refund_copy】 -- 把订单退款申请写入临时表【tab_gic_mall_order_refund_copy】
INSERT INTO `tab_gic_mall_order_refund_copy` replace INTO `tab_gic_mall_order_refund_copy`
( (
`order_refund_id` , `order_id` , `order_item_id` , `enterprise_id` , `brand_id` `order_refund_id` , `order_id` , `order_item_id` , `enterprise_id` , `brand_id`
, `apply_user` , `actual_number` , `member_id` , `order_process_id` , `refund_number` , `apply_user` , `actual_number` , `member_id` , `order_process_id` , `refund_number`
...@@ -298,7 +298,7 @@ group by r.order_item_number ...@@ -298,7 +298,7 @@ group by r.order_item_number
-- 批量发货记录 -- 批量发货记录
INSERT INTO `tab_gic_mall_order_batch_deliver_log_copy` ( replace INTO `tab_gic_mall_order_batch_deliver_log_copy` (
`mall_order_batch_deliver_log_id` `mall_order_batch_deliver_log_id`
, `batch_id` , `batch_id`
, `enterprise_id` , `order_id` , `order_number` , `enterprise_id` , `order_id` , `order_number`
...@@ -325,7 +325,7 @@ INSERT INTO `tab_gic_mall_order_batch_deliver_log_copy` ( ...@@ -325,7 +325,7 @@ INSERT INTO `tab_gic_mall_order_batch_deliver_log_copy` (
-- 把退款协商结果导入导临时表【tab_gic_mall_order_refund_consult_copy】 -- 把退款协商结果导入导临时表【tab_gic_mall_order_refund_consult_copy】
INSERT INTO `tab_gic_mall_order_refund_consult_copy` replace INTO `tab_gic_mall_order_refund_consult_copy`
( (
`order_refund_consult_id` , `order_refund_id` , `role` , `msg` `order_refund_consult_id` , `order_refund_id` , `role` , `msg`
, `refund_reason` , `refund_type` , `refund_price`, `description` , `refund_reason` , `refund_type` , `refund_price`, `description`
...@@ -342,13 +342,13 @@ FROM tab_gic_mall_order_refund_copy r ...@@ -342,13 +342,13 @@ FROM tab_gic_mall_order_refund_copy r
; ;
UPDATE order_evaluate_import e UPDATE `order_tmp_import`.order_evaluate_import e
LEFT JOIN tab_gic_mall_pro_sku sku ON e.mall_pro_sku_code = sku.mall_pro_sku_code LEFT 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 SET e.mall_pro_id = sku.mall_pro_id;
-- 把商品评论导入导临时表【tab_gic_mall_evaluate_copy】 -- 把商品评论导入导临时表【tab_gic_mall_evaluate_copy】
INSERT INTO `tab_gic_mall_evaluate_copy` replace INTO `tab_gic_mall_evaluate_copy`
( (
`evaluate_id` , `enterprise_id` , `member_id` , `evaluate_type` `evaluate_id` , `enterprise_id` , `member_id` , `evaluate_type`
, `mall_order_id` , `mall_order_item_id` , `mall_pro_id` , `evaluate_content` , `mall_order_id` , `mall_order_item_id` , `mall_pro_id` , `evaluate_content`
...@@ -372,11 +372,11 @@ group by e.id ...@@ -372,11 +372,11 @@ group by e.id
UPDATE tab_gic_mall_evaluate_copy e UPDATE tab_gic_mall_evaluate_copy e
inner JOIN `gic3.0`.tab_gic_member_SAMO members_view ON members_view.card_num = e.member_card_no inner JOIN `gic3.0`.tab_gic_member_SAMO members_view ON members_view.card_num = e.member_card_no
SET e.member_id = members_view.member_id,e.clique_member_id = members_view.clique_member_id,e.member_nickname = members_view.third_nickname, SET e.member_id = members_view.member_id,e.clique_member_id = members_view.clique_member_id,e.member_nickname = members_view.third_nickname,
e.enterprise_id = 'ff80808164f65d9501651798e0f8143d',e.clique_id = members_view.clique_id where members_view.enterprise_id='ff80808164f65d9501651798e0f8143d' e.enterprise_id = 'ff80808164f65d9501651798e0f8143d',e.clique_id = members_view.clique_id where members_view.enterprise_id='ff80808164f65d9501651798e0f8143d';
-- 把收藏夹导入导临时表【tab_gic_mall_collection_copy】 -- 把收藏夹导入导临时表【tab_gic_mall_collection_copy】
INSERT INTO `tab_gic_mall_collection_copy` replace INTO `tab_gic_mall_collection_copy`
( (
`collection_id` , `member_id` , `enterprise_id` `collection_id` , `member_id` , `enterprise_id`
, `brand_id` , `mall_pro_id` , `mall_pro_name` , `brand_id` , `mall_pro_id` , `mall_pro_name`
...@@ -403,7 +403,7 @@ group by co.card_no,co.mall_pro_code ...@@ -403,7 +403,7 @@ group by co.card_no,co.mall_pro_code
-- 把购物车信息导入导临时表【tab_gic_mall_shopping_cart_copy】 -- 把购物车信息导入导临时表【tab_gic_mall_shopping_cart_copy】
INSERT INTO `tab_gic_mall_shopping_cart_copy` ( replace INTO `tab_gic_mall_shopping_cart_copy` (
`shopping_cart_id` , `member_id` , `enterprise_id` , `brand_id` `shopping_cart_id` , `member_id` , `enterprise_id` , `brand_id`
, `mall_pro_id` , `mall_pro_name` , `mall_pro_sku_id` , `mall_pro_sku_attr` , `mall_pro_id` , `mall_pro_name` , `mall_pro_sku_id` , `mall_pro_sku_attr`
, `mall_pro_price` , `mall_pro_image_url` , `mall_pro_number` , `mall_pro_sku_price` , `mall_pro_price` , `mall_pro_image_url` , `mall_pro_number` , `mall_pro_sku_price`
...@@ -453,4 +453,4 @@ INNER JOIN ( ...@@ -453,4 +453,4 @@ INNER JOIN (
WHERE A.enterprise_id= 'ff80808164f65d9501651798e0f8143d' WHERE A.enterprise_id= 'ff80808164f65d9501651798e0f8143d'
AND r.refund_number is not null AND r.refund_number is not null
; ;
\ No newline at end of file
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