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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
| CREATE TABLE `client` (
id int NOT NULL,
tenant_id int NOT NULL,
mng_id int DEFAULT NULL COMMENT '经理 id',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='客户';
CREATE TABLE contract (
id int NOT NULL,
tenant_id int NOT NULL,
client_id int NOT NULL COMMENT '客户 id',
mng_id int DEFAULT NULL COMMENT '经理 id',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`status` char(2) COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='合同';
CREATE TABLE effort_record (
id int NOT NULL,
tenant_id int NOT NULL,
project_id int NOT NULL COMMENT '项目 id',
emp_id int NOT NULL,
work_date date NOT NULL,
effort decimal(2,1) NOT NULL COMMENT '工时',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
notes varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '备注',
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='工时记录';
CREATE TABLE emp (
id int NOT NULL,
tenant_id int NOT NULL,
org_id int NOT NULL COMMENT '组织 id',
num varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '工号',
id_num varchar(20) COLLATE utf8mb4_bin NOT NULL COMMENT '身份证号',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
gender char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '性别',
dob date DEFAULT NULL COMMENT '出生日期',
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='员工';
CREATE TABLE emp_post (
emp_id int NOT NULL,
post_code char(10) COLLATE utf8mb4_bin NOT NULL,
tenant_id int NOT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (emp_id,post_code) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='员工岗位';
CREATE TABLE org (
id int NOT NULL,
tenant_id int NOT NULL,
superior_id int DEFAULT NULL COMMENT '上级 id',
org_type_code char(10) COLLATE utf8mb4_bin NOT NULL COMMENT '组织类别代号',
leader_id int NOT NULL COMMENT '负责人 id',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='组织';
CREATE TABLE org_type (
`code` char(10) COLLATE utf8mb4_bin NOT NULL,
tenant_id int NOT NULL,
`name` varchar(50) COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (`code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='组织类别';
CREATE TABLE post (
`code` char(10) COLLATE utf8mb4_bin NOT NULL,
tenant_id int NOT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (`code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='岗位';
CREATE TABLE project (
id int NOT NULL,
tenant_id int NOT NULL,
contract_id int NOT NULL COMMENT '合同 id',
mng_id int DEFAULT NULL COMMENT '经理 id',
num varchar(50) COLLATE utf8mb4_bin NOT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='项目';
CREATE TABLE project_member (
id int NOT NULL,
tenant_id int NOT NULL,
project_id int NOT NULL COMMENT '项目 id',
emp_id int NOT NULL,
estimate_invest_ratio smallint NOT NULL COMMENT '预计投入比例',
start_at date NOT NULL,
end_at date DEFAULT NULL,
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
`status` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='项目成员';
CREATE TABLE tenant (
id int NOT NULL,
`name` varchar(50) COLLATE utf8mb4_bin NOT NULL,
create_at datetime NOT NULL,
create_by int NOT NULL,
last_updated_at datetime DEFAULT NULL,
last_updated_by int DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='租户';
|