• 权限管理表结构设计


    一、用户表USER_INFO



    1.1、脚本

    -- Create table
    create table USER_INFO
    (
      id                   NUMBER(26) not null,--序列号
      user_id              VARCHAR2(50) not null,--登录账号
      password             VARCHAR2(50) not null,--密码
      msisdn               VARCHAR2(100),--移动电话
      chs_name             VARCHAR2(50),--姓名
      email                VARCHAR2(50),--电子邮箱
      addr                 VARCHAR2(200),--地址
      phone                VARCHAR2(100),--联系电话
      is_usable            NUMBER(8) not null,--是否可用 1-是 0-否
      memo                 VARCHAR2(500),--备注
      version              NUMBER(10),--版本
      city                 VARCHAR2(50),--城市
      province             VARCHAR2(100),--省
      country              VARCHAR2(100),--国家
      postal_code          VARCHAR2(15),--邮政编码
      password_hint        VARCHAR2(100),--密码提示
      account_enabled      CHAR(1),--账号是否可用 1-是 0-否
      account_expired      CHAR(1),--账号是否过期 1-是 0-否
      account_locked       CHAR(1),--账号是否锁定 1-是 0-否
      credentials_expired  CHAR(1),--账号是否锁定 1-是 0-否
      create_man           NUMBER(26),--创建人
      site                 VARCHAR2(100),--所在位置
      dep_id               VARCHAR2(12),--所在部门编号 DEPT_INFO.CODE
      password_error_times VARCHAR2(2) default '0',
      last_login_time      DATE,
      password_error_lock  VARCHAR2(2) default '0',
      rtx_num              VARCHAR2(50)
    );
    -- Add comments to the columns 
    comment on column USER_INFO.password_error_times
      is '记录密码输错次数';
    comment on column USER_INFO.last_login_time
      is '记录上一次该账号进行登录的时间';
    comment on column USER_INFO.password_error_lock
      is '密码输入错误锁,0为正常。1为锁定';
    comment on column USER_INFO.rtx_num
      is 'RTX号码';
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table USER_INFO
      add constraint PK_USER_INFO primary key (ID)
      using index;
    alter table USER_INFO
      add constraint UQ_USER_INFO unique (USER_ID)
      using index;
    --序列
    create sequence SEQ_USER_INFO
    minvalue 1
    maxvalue 9999999999999999999999999999
    start with 90000
    increment by 1
    cache 20;
    
    二、存放对用户的子权限的分配USER_PERMREG


    2.1、脚本

    -- Create table
    create table USER_PERMREG
    (
      id          NUMBER(26) not null,
      perm_id     NUMBER(26) not null,--子权限ID,PERM_REG.ID
      user_ref_id NUMBER(26) not null,--用户ID。USER_INFO.ID
      perm_allow  NUMBER--是否同意
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table USER_PERMREG
      add constraint PK_USER_PERMREG primary key (ID)
      using index;
    --序列
    create sequence SEQ_USER_FUNC
    minvalue 1
    maxvalue 99999999999999999999999999
    start with 1
    increment by 1
    cache 20;
    
    三、存放对特定用户所分配的权限USER_RIGHT_LIST


    3.1、脚本

    -- Create table
    create table USER_RIGHT_LIST
    (
      id          NUMBER(26) not null,
      func_id     NUMBER(26) not null,--功能号,FUNC_LIST.ID
      user_ref_id NUMBER(26) not null,--用户ID。USER_INFO.ID
      perm_allow  NUMBER
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table USER_RIGHT_LIST
      add constraint PK_USER_RIGHT_LIST primary key (ID)
      using index ;
    
    --序列
    create sequence SEQ_USER_RIGHT_LIST
    minvalue 1
    maxvalue 9999999999999999999999999999
    start with 20000
    increment by 1
    cache 20;
    
    四、存放对登录用户赋予的角色USER_ROLE_REF


    4.1、脚本

    -- Create table
    create table USER_ROLE_REF
    (
      role_id NUMBER(26) not null,--角色ID
      user_id NUMBER(26) not null--用户ID
    );
    五、存放系统对用户角色的定义USER_ROL


    5.1、脚本

    -- Create table
    create table USER_ROL
    (
      id          NUMBER(26) not null,
      name        VARCHAR2(100) not null,--角色名称
      description VARCHAR2(50)--角色描写叙述
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table USER_ROL
      add constraint PK_USER_ROL primary key (ID)
      using index ;
    alter table USER_ROL
      add constraint UQ_USER_ROL unique (NAME)
      using index;
    
    --序列
    create sequence SEQ_USER_ROL
    minvalue 1
    maxvalue 9999999999999999999999999999
    start with 20000
    increment by 1
    cache 20;
    
    六、存放对角色的子权限的分配ROLE_PERMREG


    6.1、脚本

    -- Create table
    create table ROLE_PERMREG
    (
      id         NUMBER(26) not null,
      use_id     NUMBER(26),--角色ID,USER_ROL.ID
      perm_id    NUMBER(26),--子权限ID,PERM_REG.ID
      perm_allow INTEGER--是否同意
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table ROLE_PERMREG
      add constraint PK_ROLE_PERMREG primary key (ID)
      using index;
    
    --序列
    create sequence SEQ_ROLE_FUNC
    minvalue 1
    maxvalue 99999999999999999999999999
    start with 1
    increment by 1
    cache 20;
    

    七、存放对系统角色所分配的权限ROLE_RIGHT_LIST


    7.1、脚本

    -- Create table
    create table ROLE_RIGHT_LIST
    (
      id         NUMBER(26) not null,
      func_id    NUMBER(26) not null,--功能ID,FUNC_LIST.ID
      rol_ref_id NUMBER(26) not null,--角色ID,USER_ROL.ID
      perm_allow NUMBER--是否有效 1-是 0-否
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table ROLE_RIGHT_LIST
      add constraint PK_ROLE_RIGHT_LIST primary key (ID)
      using index ;
    
    --序列
    create sequence SEQ_ROLE_RIGHT_LIST
    minvalue 1
    maxvalue 9999999999999999999999999999
    start with 1
    increment by 1
    cache 20;
    
    八、存放菜单项与子权限的关联,形成按功能划分的子权限,以便为用户分配更细的权限PERM_REG


    8.1、脚本

    -- Create table
    create table PERM_REG
    (
      id      NUMBER(26) not null,
      func_id NUMBER(26),--功能ID。FUNC_LIST.ID
      def_id  NUMBER(26)--子权限ID。PERM_DEF.ID
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table PERM_REG
      add constraint PK_PERM_REG primary key (ID)
      using index;
    
    --序列
    create sequence SEQ_PERM_REG
    minvalue 1
    maxvalue 9999999999999999999999999999
    start with 30000
    increment by 1
    cache 20;
    
    九、系统菜单模块定义FUNC_LIST


    9.1、脚本

    -- Create table
    create table FUNC_LIST
    (
      id         NUMBER(26) not null,
      level      NUMBER,--级别
      parent_id  NUMBER(26),--上级菜单ID
      name       VARCHAR2(50) not null,--显示名
      url        VARCHAR2(100) not null,--相应页面的地址
      action     VARCHAR2(30) not null,--类型platform/menu/function
      is_usable  NUMBER(1) not null,--是否启用
      sort_order NUMBER(3),--排序
      memo       VARCHAR2(500),--备注
      icon       VARCHAR2(128)--显示图片所在路径
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table FUNC_LIST
      add constraint PK_FUNC_LIST primary key (ID)
      using index;
    
    --序列
    create sequence SEQ_FUNC_LIST
    minvalue 1
    maxvalue 9999999999999999999999999999
    start with 1
    increment by 1
    cache 20;
    
    十、部门信息表DEPT_INFO

    10.1、脚本

    -- Create table
    create table DEPT_INFO
    (
      id        NUMBER(26) not null,
      name      VARCHAR2(100) not null,--部门名称
      parent_id NUMBER(26) not null,--上级部门ID,DEPT_INFO.ID
      manager   NUMBER(26) not null,--部门经理
      is_dept   NUMBER(1) default 0 not null,--是否子公司 1-是 0-否
      code      VARCHAR2(6)--部门代号
    );
    -- Create/Recreate primary, unique and foreign key constraints 
    alter table DEPT_INFO
      add constraint PK_DEPT_INFO primary key (ID)
      using index;
    alter table DEPT_INFO
      add constraint UQ_DEPT_INFO unique (CODE)
      using index;
    
    --序列
    create sequence SEQ_DEPT_INFO
    minvalue 1
    maxvalue 9999999999999999999999999999
    start with 10000
    increment by 1
    cache 20;
    



  • 相关阅读:
    python中字典dict pop方法
    Markdown 学习资源
    Windows bat 设置代理
    Warning: Permanently added '...' (RSA) to the list of known hosts --Windows下git bash 警告处理
    subilme增加对markdown的高亮支持
    ubuntu笔记1
    Sublime Python 插件配置合集
    Excel VBA 快捷键 代码
    贩卖守望先锋账号
    如何用VS2017用C++语言写Hello world 程序?
  • 原文地址:https://www.cnblogs.com/wzzkaifa/p/7327717.html
Copyright © 2020-2023  润新知