Add group role tables

This commit is contained in:
2023-10-25 11:02:40 +08:00
parent 087e6ae8c3
commit 979d1d8fb8
75 changed files with 1172 additions and 30 deletions

View File

@@ -41,9 +41,9 @@ on duplicate key update name = values(name),
insert into t_element(id, name, power_id, menu_id)
values (1010100, '公用', id, 1010000),
(101010100, '基础', id, 101010000),
(102010100, '基础', id, 102010000),
(103010100, '基础', id, 103010000)
(101010100, '角色基础', id, 101010000),
(102010100, '用户组基础', id, 102010000),
(103010100, '用户基础', id, 103010000)
on duplicate key update name = values(name),
power_id=values(power_id),
menu_id = values(menu_id);

View File

@@ -2,6 +2,6 @@ drop table if exists t_power;
create table if not exists t_power
(
`id` bigint not null primary key,
`type_id` bigint not null comment '权限类型'
id bigint not null primary key,
type_id bigint not null comment '权限类型'
) comment '权限';

View File

@@ -2,9 +2,9 @@ drop table if exists t_menu;
create table if not exists t_menu
(
`id` bigint not null primary key,
`name` varchar(30) not null comment ' 菜单名',
`url` varchar(100) null comment 'URL',
`power_id` bigint not null comment '权限ID',
`parent_id` bigint null comment '父ID'
id bigint not null primary key,
name varchar(30) not null comment ' 菜单名',
url varchar(100) null comment 'URL',
power_id bigint not null comment '权限ID',
parent_id bigint null comment '父ID'
) comment '菜单';

View File

@@ -2,8 +2,8 @@ drop table if exists t_element;
create table if not exists t_element
(
`id` bigint not null primary key,
`name` varchar(100) not null comment '元素名',
`power_id` bigint not null comment '权限ID',
`menu_id` bigint not null comment '菜单ID'
id bigint not null primary key,
name varchar(100) not null comment '元素名',
power_id bigint not null comment '权限ID',
menu_id bigint not null comment '菜单ID'
) comment '页面元素';

View File

@@ -2,10 +2,10 @@ drop table if exists t_operation;
create table if not exists t_operation
(
`id` bigint not null primary key,
`name` varchar(50) not null comment '功能名',
`code` varchar(50) null comment '功能编码',
`power_id` bigint not null comment '权限ID',
`parent_id` bigint null comment '父ID',
`element_id` bigint not null comment '页面元素ID'
id bigint not null primary key,
name varchar(50) not null comment '功能名',
code varchar(50) null comment '功能编码',
power_id bigint not null comment '权限ID',
parent_id bigint null comment '父ID',
element_id bigint not null comment '页面元素ID'
) comment '功能';

View File

@@ -0,0 +1,11 @@
drop table if exists t_group;
create table if not exists t_group
(
id bigint not null primary key,
name varchar(30) not null comment '用户组名',
enable int not null comment '启用',
deleted bigint not null default 0,
version int not null default 0,
constraint t_group_unique unique (name, deleted)
) comment '用户组';

View File

@@ -0,0 +1,10 @@
drop table if exists t_user_group;
create table if not exists t_user_group
(
id bigint not null primary key,
user_id bigint not null comment '用户',
group_id bigint not null comment '用户组',
deleted bigint not null default 0,
version int not null default 0
) comment '中间表-用户-用户组';

View File

@@ -0,0 +1,11 @@
drop table if exists t_role;
create table if not exists t_role
(
id bigint not null primary key,
name varchar(20) not null comment '角色名',
enable int not null comment '启用',
deleted bigint not null default 0,
version int not null default 0,
constraint t_role_unique unique (name, deleted)
) comment '角色';

View File

@@ -0,0 +1,10 @@
drop table if exists t_role_group;
create table if not exists t_role_group
(
id bigint not null primary key,
role_id bigint not null comment '角色',
group_id bigint not null comment '群组',
deleted bigint not null default 0,
version int not null default 0
) comment '中间表-角色-用户组';

View File

@@ -0,0 +1,10 @@
drop table if exists t_user_role;
create table if not exists t_user_role
(
id bigint not null primary key,
user_id bigint not null comment '用户',
role_id bigint not null comment '角色',
deleted bigint not null default 0,
version int not null default 0
) comment '中间表-用户-角色';

View File

@@ -0,0 +1,10 @@
drop table if exists t_power_role;
create table if not exists t_power_role
(
id bigint not null primary key,
power_id bigint not null comment '权限',
role_id bigint not null comment '角色',
deleted bigint not null default 0,
version int not null default 0
) comment '中间表-权限-角色';

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.ElementMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.GroupMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.MenuMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.OperationMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.PowerMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.PowerRoleMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.PowerTypeMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.RoleGroupMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.RoleMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.UserGroupMapper">
</mapper>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.UserMapper">
<mapper namespace="top.fatweb.api.mapper.permission.UserMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="top.fatweb.api.mapper.permission.UserRoleMapper">
</mapper>