diff --git a/iam-base-starter/src/main/java/com/diboot/iam/entity/IamFrontendPermission.java b/iam-base-starter/src/main/java/com/diboot/iam/entity/IamFrontendPermission.java index 77af843..f914ade 100644 --- a/iam-base-starter/src/main/java/com/diboot/iam/entity/IamFrontendPermission.java +++ b/iam-base-starter/src/main/java/com/diboot/iam/entity/IamFrontendPermission.java @@ -49,7 +49,7 @@ public class IamFrontendPermission extends BaseEntity { private String frontendCode; // 接口列表 - @Length(max=5120, message="接口列表长度应小于5120") + @Length(max=5000, message="接口列表长度应小于5000") @TableField() private String apiSet; diff --git a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mariadb.sql b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mariadb.sql index 8fe19a3..60bca00 100644 --- a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mariadb.sql +++ b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mariadb.sql @@ -41,7 +41,7 @@ create unique index idx_iam_account on iam_account(auth_account, auth_type, user -- 角色表 create table iam_role ( - id int auto_increment comment 'ID' primary key, + id bigint auto_increment comment 'ID' primary key, name varchar(20) not null comment '名称', code varchar(20) not null comment '编码', description varchar(100) null comment '备注', @@ -52,42 +52,38 @@ create table iam_role -- 用户角色表 create table iam_user_role ( - id int auto_increment comment 'ID' primary key, + id bigint auto_increment comment 'ID' primary key, user_type varchar(100) default 'IamUser' not null comment '用户类型', user_id bigint not null comment '用户ID', - role_id int not null comment '角色ID', + role_id bigint not null comment '角色ID', is_deleted tinyint(1) default 0 not null comment '是否删除', create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间' )AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '用户角色关联'; -- 索引 create index idx_iam_user_role on iam_user_role (user_type, user_id); --- 权限表 -create table iam_permission +-- 前端资源权限表 +create table iam_frontend_permission ( - id int auto_increment comment 'ID' primary key, - parent_id int default 0 not null comment '上级ID', - application varchar(50) default 'MS' not null comment '所属应用', - type varchar(10) default 'MENU' not null comment '权限类别', - name varchar(20) not null comment '名称', - code varchar(50) null comment '编码', - operation_name varchar(50) null comment '操作名称', - operation_code varchar(50) null comment '操作编码', - sort_id smallint(6) default 999 not null comment '排序号', - extdata varchar(100) null comment '扩展属性', + id bigint auto_increment comment 'ID' primary key, + parent_id bigint default 0 not null comment '父级菜单', + display_type varchar(20) not null comment '展现类型', + display_name varchar(100) not null comment '显示名称', + frontend_code varchar(100) not null comment '前端编码', + api_set varchar(5000) null comment '接口列表', is_deleted tinyint(1) default 0 not null comment '是否删除', create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', update_time timestamp null on update CURRENT_TIMESTAMP comment '更新时间' -)AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '权限'; +)AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '前端菜单'; -- 索引 -create index idx_iam_permission on iam_permission (code); +create index idx_iam_frontend_permission on iam_frontend_permission (parent_id); -- 角色-权限 create table iam_role_permission ( - id int auto_increment comment 'ID' primary key, - role_id int not null comment '角色ID', - permission_id int not null comment '权限ID', + id bigint auto_increment comment 'ID' primary key, + role_id bigint not null comment '角色ID', + permission_id bigint not null comment '权限ID', is_deleted tinyint(1) default 0 not null comment '是否删除', create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间' )AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COMMENT '角色权限'; diff --git a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mysql.sql b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mysql.sql index 83d77d0..0bb24c9 100644 --- a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mysql.sql +++ b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-mysql.sql @@ -70,7 +70,7 @@ create table iam_frontend_permission display_type varchar(20) not null comment '展现类型', display_name varchar(100) not null comment '显示名称', frontend_code varchar(100) not null comment '前端编码', - api_set varchar(5120) null comment '接口列表', + api_set varchar(5000) null comment '接口列表', is_deleted tinyint(1) default 0 not null comment '是否删除', create_time timestamp default CURRENT_TIMESTAMP not null comment '创建时间', update_time timestamp null on update CURRENT_TIMESTAMP comment '更新时间' diff --git a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-oracle.sql b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-oracle.sql index 812f4ad..bdab4b8 100644 --- a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-oracle.sql +++ b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-oracle.sql @@ -70,7 +70,7 @@ create unique index idx_iam_account on ${SCHEMA}.iam_account(auth_account, auth_ -- 角色表 create table ${SCHEMA}.iam_role ( - id NUMBER(11) generated as identity ( start with 10000 nocycle noorder), + id NUMBER(20) generated as identity ( start with 10000 nocycle noorder), name VARCHAR2(20) not null, code VARCHAR2(20) not null, description VARCHAR2(100) null, @@ -89,7 +89,7 @@ comment on table ${SCHEMA}.iam_role is '角色'; -- 用户角色表 create table ${SCHEMA}.iam_user_role ( - id NUMBER(11) generated as identity ( start with 10000 nocycle noorder), + id NUMBER(20) generated as identity ( start with 10000 nocycle noorder), user_type VARCHAR2(100) default 'IamUser' not null, user_id NUMBER(20) not null, role_id int not null, @@ -107,45 +107,38 @@ comment on table ${SCHEMA}.iam_user_role is '用户角色关联'; -- 索引 create index idx_iam_user_role on ${SCHEMA}.iam_user_role (user_type, user_id); --- 权限表 -create table ${SCHEMA}.iam_permission +-- 前端权限表 +create table ${SCHEMA}.iam_frontend_permission ( - id NUMBER(11) generated as identity ( start with 10000 nocycle noorder), - parent_id int default 0 not null, - application VARCHAR2(50) default 'MS' not null, - type VARCHAR2(10) default 'MENU' not null, - name VARCHAR2(20) not null, - code VARCHAR2(50) null, - operation_name VARCHAR2(50) null, - operation_code VARCHAR2(50) null, - sort_id smallint default 999 not null, - extdata VARCHAR2(100) null, + id NUMBER(20) generated as identity ( start with 10000 nocycle noorder), + parent_id NUMBER(20) default 0 not null, + display_type VARCHAR2(20) not null, + display_name VARCHAR2(100) not null, + frontend_code VARCHAR2(100) null, + api_set VARCHAR2(5000) null, is_deleted NUMBER(1) DEFAULT 0 not null, create_time timestamp default CURRENT_TIMESTAMP not null, update_time timestamp null, constraint PK_iam_permission primary key (id) ); -comment on column ${SCHEMA}.iam_permission.id is 'ID'; -comment on column ${SCHEMA}.iam_permission.parent_id is '上级ID'; -comment on column ${SCHEMA}.iam_permission.application is '所属应用'; -comment on column ${SCHEMA}.iam_permission.type is '权限类别'; -comment on column ${SCHEMA}.iam_permission.name is '名称'; -comment on column ${SCHEMA}.iam_permission.code is '编码'; -comment on column ${SCHEMA}.iam_permission.operation_name is '操作名称'; -comment on column ${SCHEMA}.iam_permission.operation_code is '操作编码'; -comment on column ${SCHEMA}.iam_permission.sort_id is '排序号'; -comment on column ${SCHEMA}.iam_permission.extdata is '扩展属性'; -comment on column ${SCHEMA}.iam_permission.is_deleted is '是否删除'; -comment on column ${SCHEMA}.iam_permission.create_time is '创建时间'; -comment on column ${SCHEMA}.iam_permission.update_time is '更新时间'; -comment on table ${SCHEMA}.iam_permission is '权限'; +comment on column ${SCHEMA}.iam_frontend_permission.id is 'ID'; +comment on column ${SCHEMA}.iam_frontend_permission.parent_id is '菜单ID'; +comment on column ${SCHEMA}.iam_frontend_permission.display_type is '展现类型'; +comment on column ${SCHEMA}.iam_frontend_permission.display_name is '显示名称'; +comment on column ${SCHEMA}.iam_frontend_permission.frontend_code is '前端编码'; +comment on column ${SCHEMA}.iam_frontend_permission.api_set is '接口列表'; +comment on column ${SCHEMA}.iam_frontend_permission.is_deleted is '是否删除'; +comment on column ${SCHEMA}.iam_frontend_permission.create_time is '创建时间'; +comment on column ${SCHEMA}.iam_frontend_permission.update_time is '更新时间'; +comment on table ${SCHEMA}.iam_frontend_permission is '前端权限表'; + -- 索引 -create index idx_iam_permission on ${SCHEMA}.iam_permission (code); +create index idx_iam_frontend_permission on ${SCHEMA}.iam_frontend_permission (parent_id); -- 角色-权限 create table ${SCHEMA}.iam_role_permission ( - id NUMBER(11) generated as identity ( start with 10000 nocycle noorder) , + id NUMBER(20) generated as identity ( start with 10000 nocycle noorder) , role_id int not null, permission_id int not null, is_deleted NUMBER(1) DEFAULT 0 not null, diff --git a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-postgresql.sql b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-postgresql.sql index d786357..2c8a6c9 100644 --- a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-postgresql.sql +++ b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-postgresql.sql @@ -68,7 +68,7 @@ create unique index idx_iam_account on iam_account(auth_account, auth_type, user -- 角色表 create table iam_role ( - id serial not null, + id bigserial not null, name varchar(20) not null, code varchar(20) not null, description varchar(100) null, @@ -86,10 +86,10 @@ comment on table iam_role is '角色'; -- 用户角色表 create table iam_user_role ( - id serial not null, + id bigserial not null, user_type varchar(100) default 'IamUser' not null, user_id bigint not null, - role_id int not null, + role_id bigint not null, is_deleted BOOLEAN default FALSE not null, create_time timestamp default CURRENT_TIMESTAMP not null ); @@ -103,46 +103,40 @@ comment on table iam_user_role is '用户角色关联'; -- 索引 create index idx_iam_user_role on iam_user_role (user_type, user_id); --- 权限表 -create table iam_permission +-- 前端权限表 +create table iam_frontend_permission ( - id serial not null, - parent_id int default 0 not null, - application varchar(50) default 'MS' not null, - type varchar(10) default 'MENU' not null, - name varchar(20) not null, - code varchar(50) null, - operation_name varchar(50) null, - operation_code varchar(50) null, - sort_id smallint default 999 not null, - extdata varchar(100) null, + id bigserial not null, + parent_id bigint default 0 not null, + display_type varchar(20) not null, + display_name varchar(100) not null, + frontend_code varchar(100) null, + api_set varchar(5000) null, is_deleted BOOLEAN default FALSE not null, create_time timestamp default CURRENT_TIMESTAMP not null, - update_time timestamp null + update_time timestamp null, + constraint PK_iam_frontend_permission primary key (id) ); -comment on column iam_permission.id is 'ID'; -comment on column iam_permission.parent_id is '上级ID'; -comment on column iam_permission.application is '所属应用'; -comment on column iam_permission.type is '权限类别'; -comment on column iam_permission.name is '名称'; -comment on column iam_permission.code is '编码'; -comment on column iam_permission.operation_name is '操作名称'; -comment on column iam_permission.operation_code is '操作编码'; -comment on column iam_permission.sort_id is '排序号'; -comment on column iam_permission.extdata is '扩展属性'; -comment on column iam_permission.is_deleted is '是否删除'; -comment on column iam_permission.create_time is '创建时间'; -comment on column iam_permission.update_time is '更新时间'; -comment on table iam_permission is '权限'; +comment on column iam_frontend_permission.id is 'ID'; +comment on column iam_frontend_permission.parent_id is '菜单ID'; +comment on column iam_frontend_permission.display_type is '展现类型'; +comment on column iam_frontend_permission.display_name is '显示名称'; +comment on column iam_frontend_permission.frontend_code is '前端编码'; +comment on column iam_frontend_permission.api_set is '接口列表'; +comment on column iam_frontend_permission.is_deleted is '是否删除'; +comment on column iam_frontend_permission.create_time is '创建时间'; +comment on column iam_frontend_permission.update_time is '更新时间'; +comment on table iam_frontend_permission is '前端权限表'; + -- 索引 -create index idx_iam_permission on iam_permission (code); +create index idx_iam_frontend_permission on iam_frontend_permission (parent_id); -- 角色-权限 create table iam_role_permission ( - id serial not null , - role_id int not null , - permission_id int not null , + id bigserial not null , + role_id bigint not null , + permission_id bigint not null , is_deleted BOOLEAN default FALSE not null , create_time timestamp default CURRENT_TIMESTAMP not null ); diff --git a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-sqlserver.sql b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-sqlserver.sql index fe3dccd..8bda676 100644 --- a/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-sqlserver.sql +++ b/iam-base-starter/src/main/resources/META-INF/sql/init-iam-base-sqlserver.sql @@ -70,7 +70,7 @@ create unique index idx_iam_account on iam_account(auth_account, auth_type, user -- 角色表 create table ${SCHEMA}.iam_role ( - id int identity, + id bigint identity, name varchar(20) not null, code varchar(20) not null, description varchar(100) null, @@ -89,10 +89,10 @@ execute sp_addextendedproperty 'MS_Description', N'角色', 'SCHEMA', '${SCHEMA} -- 用户角色表 create table ${SCHEMA}.iam_user_role ( - id int identity, + id bigint identity, user_type varchar(100) default 'IamUser' not null, user_id bigint not null, - role_id int not null, + role_id bigint not null, is_deleted tinyint default 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, constraint PK_iam_user_role primary key (id) @@ -107,47 +107,41 @@ execute sp_addextendedproperty 'MS_Description', N'用户角色关联', 'SCHEMA' -- 索引 create nonclustered index idx_iam_user_role on iam_user_role (user_type, user_id); --- 权限表 -create table ${SCHEMA}.iam_permission +-- 前端权限表 +create table ${SCHEMA}.iam_frontend_permission ( - id int identity, - parent_id int default 0 not null, - application varchar(50) default 'MS' not null, - type varchar(10) default 'MENU' not null, - name varchar(20) not null, - code varchar(50) null, - operation_name varchar(50) null, - operation_code varchar(50) null, - sort_id smallint default 999 not null, - extdata varchar(100) null, + id bigint identity, + parent_id bigint default 0 not null, + display_type varchar(20) not null, + display_name varchar(100) not null, + frontend_code varchar(100) null, + api_set varchar(5000) null, is_deleted tinyint default 0 not null, create_time datetime default CURRENT_TIMESTAMP not null, update_time datetime null, - constraint PK_iam_permission primary key (id) + constraint PK_iam_frontend_permission primary key (id) ); -execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'id'; -execute sp_addextendedproperty 'MS_Description', N'上级ID', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'parent_id'; -execute sp_addextendedproperty 'MS_Description', N'所属应用', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'application'; -execute sp_addextendedproperty 'MS_Description', N'权限类别', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'type'; -execute sp_addextendedproperty 'MS_Description', N'名称', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'name'; -execute sp_addextendedproperty 'MS_Description', N'编码', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'code'; -execute sp_addextendedproperty 'MS_Description', N'操作名称', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'operation_name'; -execute sp_addextendedproperty 'MS_Description', N'操作编码', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'operation_code'; -execute sp_addextendedproperty 'MS_Description', N'排序号', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'sort_id'; -execute sp_addextendedproperty 'MS_Description', N'扩展属性', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'extdata'; -execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'is_deleted'; -execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'create_time'; -execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, 'column', 'update_time'; -execute sp_addextendedproperty 'MS_Description', N'权限', 'SCHEMA', '${SCHEMA}', 'table', iam_permission, null, null; +execute sp_addextendedproperty 'MS_Description', N'ID', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'id'; +execute sp_addextendedproperty 'MS_Description', N'菜单ID', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'parent_id'; +execute sp_addextendedproperty 'MS_Description', N'展现类型', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'display_type'; +execute sp_addextendedproperty 'MS_Description', N'显示名称', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'display_name'; +execute sp_addextendedproperty 'MS_Description', N'前端编码', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'frontend_code'; +execute sp_addextendedproperty 'MS_Description', N'接口列表', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'api_set'; +execute sp_addextendedproperty 'MS_Description', N'是否删除', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'is_deleted'; +execute sp_addextendedproperty 'MS_Description', N'创建时间', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'create_time'; +execute sp_addextendedproperty 'MS_Description', N'更新时间', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, 'column', 'update_time'; +execute sp_addextendedproperty 'MS_Description', N'前端权限表', 'SCHEMA', '${SCHEMA}', 'table', iam_frontend_permission, null, null; + -- 索引 -create nonclustered index idx_iam_permission on iam_permission (code); +create nonclustered index idx_iam_frontend_permission on iam_frontend_permission (parent_id); + -- 角色-权限 create table ${SCHEMA}.iam_role_permission ( - id int identity , - role_id int not null , - permission_id int not null , + id bigint identity , + role_id bigint not null , + permission_id bigint not null , is_deleted tinyint default 0 not null , create_time datetime default CURRENT_TIMESTAMP not null, constraint PK_iam_role_permission primary key (id)