前后台分离vue前台,springboot后台shiruo角色管理表结构

环境:项目原因需要,需要用户根据自身的角色,公司,登陆网站,显示当前用户需要展示的页面,以及该用户需要显示执行的权限,没有权限,则不显示该权限的按键,根据表结构去实现逻辑,实现用户管理

表逻辑:

组织(公司|职务)《=》用户(账号)《=》角色(岗位)《=》资源(页面|权限)

create table organization
(
    id          bigint(19) auto_increment comment '主键id'
        primary key,
    name        varchar(64)          not null comment '组织名',
    address     varchar(100)         null comment '地址',
    code        varchar(64)          not null comment '编号',
    icon        varchar(32)          null comment '图标',
    pid         bigint(19)           null comment '父级主键',
    seq         tinyint(2) default 0 not null comment '排序',
    create_time datetime             not null comment '创建时间'
)
    comment '组织机构';
create table user
(
    id              bigint(19) auto_increment comment '主键id'
        primary key,
    login_name      varchar(64)          not null comment '登陆名',
    name            varchar(64)          not null comment '用户名',
    password        varchar(64)          not null comment '密码',
    openid          varchar(50)          null comment '微信id',
    sex             tinyint(2) default 0 not null comment '性别',
    age             tinyint(2) default 0 null comment '年龄',
    phone           varchar(20)          null comment '手机号',
    user_type       tinyint(2) default 0 not null comment '用户类别',
    status          tinyint(2) default 0 not null comment '用户状态',
    organization_id int        default 0 not null comment '所属机构',
    create_time     datetime             not null comment '创建时间',
    constraint IDx_user_login_name
        unique (login_name)
)
    comment '用户';
create table role
(
    id          bigint(19) auto_increment comment '主键id'
        primary key,
    name        varchar(64)          not null comment '角色名',
    seq         tinyint(2) default 0 not null comment '排序号',
    description varchar(255)         null comment '简介',
    status      tinyint(2) default 0 not null comment '状态'
)
    comment '角色';
create table user_role
(
    id      bigint(19) auto_increment comment '主键id'
        primary key,
    user_id bigint(19) not null comment '用户id',
    role_id bigint(19) not null comment '角色id'
)
    comment '用户角色';

create index idx_user_role_ids
    on Longi.user_role (user_id, role_id);
create table resource
(
    id            bigint(19) auto_increment comment '主键',
    name          varchar(64)          not null comment '资源名称',
    url           varchar(100)         null comment '资源路径',
    description   varchar(255)         null comment '资源介绍',
    icon          varchar(32)          null comment '资源图标',
    pid           bigint(19)           null comment '父级资源id',
    seq           bigint     default 0 not null comment '排序',
    status        tinyint(2) default 0 not null comment '状态',
    resource_type bigint     default 0 not null comment '资源类别',
    create_time   datetime             not null comment '创建时间',
    constraint resource_id_uindex
        unique (id)
)
    comment '资源';
create table role_resource
(
    id          bigint(19) auto_increment comment '主键id'
        primary key,
    role_id     bigint(19) not null comment '角色id',
    resource_id bigint(19) not null comment '资源id'
)
    comment '角色资源';

create index idx_role_resource_ids
    on Longi.role_resource (role_id, resource_id);

 实现效果:

 PS:这个页面是资源页面,其他逻辑还要自己去实现前后台交互,根据表结构实现,非常方便,个人就是这样实现的,祝好运~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

沉默老曹

老板大气!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值