create_tables.sql
3.9 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
CREATE TABLE IF NOT EXISTS "crm_contract" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar NOT NULL,
"customer_id" bigint,
"business_id" bigint,
"process_instance_id" bigint,
"order_date" varchar,
"owner_user_id" bigint,
"no" varchar,
"start_time" varchar,
"end_time" varchar,
"price" int,
"discount_percent" int,
"product_price" int,
"ro_user_ids" varchar,
"rw_user_ids" varchar,
"contact_id" bigint,
"sign_user_id" bigint,
"contact_last_time" varchar,
"remark" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '合同表';
CREATE TABLE IF NOT EXISTS "crm_clue" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"transform_status" bit NOT NULL,
"follow_up_status" bit NOT NULL,
"name" varchar NOT NULL,
"customer_id" bigint NOT NULL,
"contact_next_time" varchar,
"telephone" varchar,
"mobile" varchar,
"address" varchar,
"owner_user_id" bigint,
"contact_last_time" varchar,
"remark" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("id")
) COMMENT '线索表';
CREATE TABLE IF NOT EXISTS "crm_receivable" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"no" varchar,
"plan_id" bigint,
"customer_id" bigint,
"contract_id" bigint,
"check_status" int,
"process_instance_id" bigint,
"return_time" varchar,
"return_type" varchar,
"price" varchar,
"owner_user_id" bigint,
"batch_id" bigint,
"sort" int,
"data_scope" int,
"data_scope_dept_ids" varchar,
"status" int NOT NULL,
"remark" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '回款管理';
CREATE TABLE IF NOT EXISTS "crm_receivable_plan" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"index_no" bigint,
"receivable_id" bigint,
"status" int NOT NULL,
"check_status" varchar,
"process_instance_id" bigint,
"price" varchar,
"return_time" varchar,
"remind_days" bigint,
"remind_time" varchar,
"customer_id" bigint,
"contract_id" bigint,
"owner_user_id" bigint,
"sort" int,
"remark" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '回款计划';
CREATE TABLE IF NOT EXISTS "crm_customer" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar,
"follow_up_status" bit NOT NULL,
"lock_status" bit NOT NULL,
"deal_status" bit NOT NULL,
"mobile" varchar,
"telephone" varchar,
"website" varchar,
"remark" varchar,
"owner_user_id" bigint,
"ro_user_ids" varchar,
"rw_user_ids" varchar,
"area_id" bigint,
"detail_address" varchar,
"contact_last_time" varchar,
"contact_next_time" varchar,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL,
PRIMARY KEY ("id")
) COMMENT '客户表';