-
Notifications
You must be signed in to change notification settings - Fork 98
/
crmInboxTrigger.sql
107 lines (105 loc) · 5.43 KB
/
crmInboxTrigger.sql
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
DELIMITER $$
CREATE TRIGGER inbox_insert_trigger AFTER INSERT ON crm.sys_email_folder
FOR EACH ROW BEGIN
SET @ret=
redis_commands("192.168.0.118",6379,"rpush","crmInboxEvents",
json_object(
json_members
(
"op",
"update",
"value",
json_object
(
NEW.Id as "Id",NEW.type as "type",
NEW.mailserver_id as "mailserver_id",NEW.sender as "sender",
NEW.sender_name as "sender_name",NEW.recevier as "recevier",
NEW.replyto as "replyto",NEW.bbemails as "bbemails",
NEW.ccemails as "ccemails",NEW.subject as "subject",
NEW.content as "content",NEW.email_size as "email_size",
NEW.important_flag as "important_flag",NEW.attach_flag as "attach_flag",
NEW.read_flag as "read_flag",NEW.process_flag as "process_flag",
NEW.recevi_time as "recevi_time",NEW.email_flag as "email_flag",
NEW.urgent_flag as "urgent_flag",NEW.receipt_flag as "receipt_flag",
NEW.refer_linkmanid as "refer_linkmanid",NEW.refer_cusid as "refer_cusid",
NEW.company_id as "company_id",NEW.tags as "tags",
NEW.create_time as "create_time",NEW.create_user as "create_user",
NEW.lastupdate_time as "lastupdate_time",NEW.lastupdate_user as "lastupdate_user",
NEW.refer_attachIds as "refer_attachIds",NEW.copyrecevier as "copyrecevier",
NEW.fullrecevier as "fullrecevier",NEW.reply_time as "reply_time"
)
)
)
,"");
END$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER inbox_update_trigger AFTER UPDATE ON crm.sys_email_folder
FOR EACH ROW BEGIN
SET @ret=
redis_commands("192.168.0.118",6379,"rpush","crmInboxEvents",
json_object(
json_members
(
"op",
"update",
"value",
json_object
(
NEW.Id as "Id",NEW.type as "type",
NEW.mailserver_id as "mailserver_id",NEW.sender as "sender",
NEW.sender_name as "sender_name",NEW.recevier as "recevier",
NEW.replyto as "replyto",NEW.bbemails as "bbemails",
NEW.ccemails as "ccemails",NEW.subject as "subject",
NEW.content as "content",NEW.email_size as "email_size",
NEW.important_flag as "important_flag",NEW.attach_flag as "attach_flag",
NEW.read_flag as "read_flag",NEW.process_flag as "process_flag",
NEW.recevi_time as "recevi_time",NEW.email_flag as "email_flag",
NEW.urgent_flag as "urgent_flag",NEW.receipt_flag as "receipt_flag",
NEW.refer_linkmanid as "refer_linkmanid",NEW.refer_cusid as "refer_cusid",
NEW.company_id as "company_id",NEW.tags as "tags",
NEW.create_time as "create_time",NEW.create_user as "create_user",
NEW.lastupdate_time as "lastupdate_time",NEW.lastupdate_user as "lastupdate_user",
NEW.refer_attachIds as "refer_attachIds",NEW.copyrecevier as "copyrecevier",
NEW.fullrecevier as "fullrecevier",NEW.reply_time as "reply_time"
)
)
)
,"");
END$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER inbox_delete_trigger AFTER DELETE ON crm.sys_email_folder
FOR EACH ROW BEGIN
SET @ret=
redis_commands("192.168.0.118",6379,"rpush","crmInboxEvents",
json_object(
json_members
(
"op",
"delete",
"value",
json_object
(
OLD.Id as "Id",OLD.type as "type",
OLD.mailserver_id as "mailserver_id",OLD.sender as "sender",
OLD.sender_name as "sender_name",OLD.recevier as "recevier",
OLD.replyto as "replyto",OLD.bbemails as "bbemails",
OLD.ccemails as "ccemails",OLD.subject as "subject",
OLD.content as "content",OLD.email_size as "email_size",
OLD.important_flag as "important_flag",OLD.attach_flag as "attach_flag",
OLD.read_flag as "read_flag",OLD.process_flag as "process_flag",
OLD.recevi_time as "recevi_time",OLD.email_flag as "email_flag",
OLD.urgent_flag as "urgent_flag",OLD.receipt_flag as "receipt_flag",
OLD.refer_linkmanid as "refer_linkmanid",OLD.refer_cusid as "refer_cusid",
OLD.company_id as "company_id",OLD.tags as "tags",
OLD.create_time as "create_time",OLD.create_user as "create_user",
OLD.lastupdate_time as "lastupdate_time",OLD.lastupdate_user as "lastupdate_user",
OLD.refer_attachIds as "refer_attachIds",OLD.copyrecevier as "copyrecevier",
OLD.fullrecevier as "fullrecevier",OLD.reply_time as "reply_time"
)
)
)
,"");
END$$
DELIMITER ;