pd建模图
建模语句
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
alter table sys_authorities_resources
drop constraint fk_sys_auth_reference_sys_auth;
alter table sys_authorities_resources
drop constraint fk_sys_auth_reference_sys_reso;
alter table sys_resources
drop constraint fk_sys_reso_reference_sys_modu;
alter table sys_roles_authorities
drop constraint fk_sys_role_reference_sys_role;
alter table sys_roles_authorities
drop constraint fk_sys_role_reference_sys_auth;
alter table sys_roles_moudles
drop constraint fk_sys_role_reference_sys_modu;
alter table sys_roles_moudles
drop constraint fk_s_role_reference_sys_role;
alter table sys_users_roles
drop constraint fk_sys_user_reference_sys_user;
alter table sys_users_roles
drop constraint fk_sys_user_reference_sys_role;
drop table persistent_logins cascade constraints;
drop table sys_authorities cascade constraints;
drop table sys_authorities_resources cascade constraints;
drop table sys_modules cascade constraints;
drop table sys_resources cascade constraints;
drop table sys_roles cascade constraints;
drop table sys_roles_authorities cascade constraints;
drop table sys_roles_moudles cascade constraints;
drop table sys_users cascade constraints;
drop table sys_users_roles cascade constraints;
/*==============================================================*/
/* table: persistent_logins */
/*==============================================================*/
create table persistent_logins (
username varchar2(64),
series varchar2(64) not null,
token varchar2(64),
last_used timestamp,
constraint pk_persistent_logins primary key (series)
);
comment on table persistent_logins is
'spring remember me 持久化';
/*==============================================================*/
/* table: sys_authorities */
/*==============================================================*/
create table sys_authorities (
authority_id varchar2(100) not null,
authority_mark varchar2(100),
authority_name varchar2(100) not null,
authority_desc varchar2(200),
message varchar2(100),
enable number,
issys number,
module_id varchar2(100),
constraint pk_sys_authorities primary key (authority_id)
);
/*==============================================================*/
/* table: sys_authorities_resources */
/*==============================================================*/
create table sys_authorities_resources (
id varchar2(100) not null,
resource_id varchar2(100) not null,
authority_id varchar2(100) not null,
constraint pk_sys_authorities_resources primary key (id)
);
/*==============================================================*/
/* table: sys_modules */
/*==============================================================*/
create table sys_modules (
module_id varchar2(100) not null,
module_name varchar2(100) not null,
module_desc varchar2(200),
module_type varchar2(100),
parent varchar2(100),
module_url varchar2(100),
i_level number,
leaf number,
application varchar2(100),
controller varchar2(100),
enable number(1),
priority number,
constraint pk_sys_modules primary key (module_id)
);
comment on column sys_modules.i_level is
'1';
/*==============================================================*/
/* table: sys_resources */
/*==============================================================*/
create table sys_resources (
resource_id varchar2(100) not null,
resource_type varchar2(100),
resource_name varchar2(100),
resource_desc varchar2(200),
resource_path varchar2(200),
priority varchar2(100),
enable number,
issys number,
module_id varchar2(100),
constraint pk_sys_resources primary key (resource_id)
);
comment on column sys_resources.resource_type is
'url,method';
/*==============================================================*/
/* table: sys_roles */
/*==============================================================*/
create table sys_roles (
role_id varchar2(100) not null,
role_name varchar2(100),
role_desc varchar2(200),
enable number,
issys number,
module_id varchar2(100),
constraint pk_sys_roles primary key (role_id)
);
/*==============================================================*/
/* table: sys_roles_authorities */
/*==============================================================*/
create table sys_roles_authorities (
id varchar2(100) not null,
authority_id varchar2(100) not null,
role_id varchar2(100) not null,
constraint pk_sys_roles_authorities primary key (id)
);
/*==============================================================*/
/* table: sys_roles_moudles */
/*==============================================================*/
create table sys_roles_moudles (
id varchar2(100) not null,
module_id varchar2(100) not null,
role_id varchar2(100) not null,
constraint pk_sys_roles_moudles primary key (id)
);
comment on table sys_roles_moudles is
'控制角色对模块的访问权,主要用于生成菜单';
/*==============================================================*/
/* table: sys_users */
/*==============================================================*/
create table sys_users (
user_id varchar2(100) not null,
username varchar2(100) not null,
name varchar2(100),
password varchar2(100) not null,
dt_create date default sysdate,
last_login date,
deadline date,
login_ip varchar2(100),
v_qzjgid varchar2(100),
v_qzjgmc varchar2(100),
dep_id varchar2(100),
dep_name varchar2(100),
enabled number,
account_non_expired number,
account_non_locked number,
credentials_non_expired number,
constraint pk_sys_users primary key (user_id)
);
/*==============================================================*/
/* table: sys_users_roles */
/*==============================================================*/
create table sys_users_roles (
id varchar2( 100 ) not null ,
role_id varchar2( 100 ) not null ,
user_id varchar2( 100 ) not null ,
constraint pk_sys_users_roles primary key (id)
);
alter table sys_authorities_resources
add constraint fk_sys_auth_reference_sys_auth foreign key (authority_id)
references sys_authorities (authority_id);
alter table sys_authorities_resources
add constraint fk_sys_auth_reference_sys_reso foreign key (resource_id)
references sys_resources (resource_id);
alter table sys_resources
add constraint fk_sys_reso_reference_sys_modu foreign key (module_id)
references sys_modules (module_id);
alter table sys_roles_authorities
add constraint fk_sys_role_reference_sys_role foreign key (role_id)
references sys_roles (role_id);
alter table sys_roles_authorities
add constraint fk_sys_role_reference_sys_auth foreign key (authority_id)
references sys_authorities (authority_id);
alter table sys_roles_moudles
add constraint fk_sys_role_reference_sys_modu foreign key (module_id)
references sys_modules (module_id);
alter table sys_roles_moudles
add constraint fk_s_role_reference_sys_role foreign key (role_id)
references sys_roles (role_id);
alter table sys_users_roles
add constraint fk_sys_user_reference_sys_user foreign key (user_id)
references sys_users (user_id);
alter table sys_users_roles
add constraint fk_sys_user_reference_sys_role foreign key (role_id)
references sys_roles (role_id);
|
总结
以上所述是小编给大家介绍的spring security数据库表结构实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!
原文链接:http://blog.sina.com.cn/s/blog_9c6852670102wwi4.html