1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
ALTER table ecw_offer_log add column customer_id bigint DEFAULT NULL COMMENT '客户ID';
ALTER table ecw_customer_follow add column biz_no varchar(200) DEFAULT NULL COMMENT '业务编码';
-- 迁移报价单商务洽谈跟进记录脚本
INSERT INTO `ecw_customer_follow` (
id,
customer_id,
biz_id,
biz_no,
follow_type,
contact_name,
follow_time,
follow_method,
follow_user_id,
feedback,
result,
admin_id,
creator,
create_time,
deleted
) SELECT
IF
( 1 = 1, NULL, 1 ) AS id,
o.relation_id AS customer_id,
l.offer_id AS biz_id,
l.number AS biz_no,
4,
cc.`name` AS contact_name,
l.follow_up_time AS follow_time,
l.follow_up_method AS follow_method,
l.follow_up_salesman_id AS follow_user_id,
l.customer_feedback AS feedback,
l.processing_results AS result,
l.creator AS admin_id,
l.creator AS creator,
l.create_time AS create_time,
0
FROM
ecw_offer_log l
LEFT JOIN ecw_offer o ON l.offer_id = o.offer_id
LEFT JOIN ecw_customer_contacts cc ON l.contacts = cc.id
WHERE
type = 2