【研究中】sql server权限用户设置23.11.26

sql 复制代码
--更新时间2023.11.26 21:30   负责人:jerrys


use DBAliCMS




IF EXISTS (select * from sysobjects where name='hkcms_user')--判断是否存在此表
    DROP TABLE hkcms_user
CREATE TABLE hkcms_user (
  id int primary key identity(1, 1),
  username char(32)  NOT NULL unique,-- '登录名称',
  nickname char(50)  NOT NULL DEFAULT '' ,-- '昵称',
  email char(50)  NOT NULL DEFAULT '' ,-- '邮箱',
  mobile char(11)  NOT NULL DEFAULT '' ,-- '手机',
  password char(32)  NOT NULL ,-- '密码',
  salt char(10)  NOT NULL ,-- '密码盐',
  money decimal(10,2) NOT NULL DEFAULT '0.00' ,-- '金额',
  score int NOT NULL DEFAULT '0' ,-- '积分',
  level int NOT NULL DEFAULT '0' ,-- '等级',
  exp int NOT NULL DEFAULT '0' ,-- '经验值',
  avatar char(255)  NOT NULL DEFAULT '' ,-- '头像',
  gender int NOT NULL DEFAULT '0' ,-- '性别:1-男,2-女,0-未指定',
  birthday date DEFAULT NULL ,-- '生日',
  introduction char(255)  NOT NULL DEFAULT '' ,-- '个人简介',
  remark char(255)  NOT NULL DEFAULT '' ,-- '备注',
  latest_time datetime DEFAULT NULL ,-- '上次登录时间',
  login_time datetime DEFAULT NULL ,-- '登录时间',
  login_ip char(50)  NOT NULL DEFAULT '' ,-- '登录IP',
  login_failed int NOT NULL DEFAULT '0' ,-- '登录失败次数',
  status varchar(20)  NOT NULL DEFAULT 'normal' ,-- '状态:normal-正常,hidden-禁用',
  create_time datetime DEFAULT NULL ,-- '创建时间',
  update_time datetime DEFAULT NULL ,-- '更新时间',

) --='用户表';

IF EXISTS (select * from sysobjects where name='hkcms_user_group')--判断是否存在此表
    DROP TABLE hkcms_user_group
CREATE TABLE hkcms_user_group (
  id int primary key identity(1, 1),-- 'ID',
  parent_id int NOT NULL DEFAULT '0' ,-- '父级',
  name varchar(20)  NOT NULL DEFAULT '' ,-- '名称',
  rules text  NOT NULL ,-- '规则',
  remark varchar(255)  NOT NULL DEFAULT '' ,-- '备注',
  status varchar(20)  NOT NULL DEFAULT 'normal' ,-- '状态:normal-正常,hidden-禁用',
  create_time datetime DEFAULT NULL ,-- '创建时间',
  update_time datetime DEFAULT NULL ,-- '更新时间',
  
) --='角色管理';

IF EXISTS (select * from sysobjects where name='hkcms_user_group_access')--判断是否存在此表
    DROP TABLE hkcms_user_group_access
CREATE TABLE hkcms_user_group_access (
  user_id int NOT NULL ,-- '用户表ID',
  group_id int NOT NULL ,-- '角色组ID',
  create_time datetime DEFAULT NULL ,-- '创建时间',
  update_time datetime DEFAULT NULL ,-- '更新时间',
 
) --='权限分组表';

IF EXISTS (select * from sysobjects where name='hkcms_user_rule')--判断是否存在此表
    DROP TABLE hkcms_user_rule
CREATE TABLE hkcms_user_rule (
  id int primary key identity(1, 1) ,-- 'ID',
  parent_id int NOT NULL DEFAULT '0' ,-- '父级',
  name char(80)  NOT NULL unique DEFAULT '' ,-- '规则',
  title char(50)  NOT NULL DEFAULT '' ,-- '标题',
  route char(80)  NOT NULL ,-- '路由',
  app char(20)  NOT NULL DEFAULT '' ,-- '所属应用',
  icon char(50)  NOT NULL DEFAULT '' ,-- '图标',
  remark char(250)  NOT NULL DEFAULT '' ,-- '备注',
  weigh int NOT NULL DEFAULT '0' ,-- '排序',
  type int NOT NULL DEFAULT '1' ,-- '类型:0-权限规则,1-菜单,2-额外标识',
  status varchar(20)  NOT NULL DEFAULT 'normal' ,-- '状态:normal-正常,hidden-禁用',
  create_time datetime DEFAULT NULL ,-- '创建时间',
  update_time datetime DEFAULT NULL -- '更新时间',

) --='菜单规则';

--DROP TABLE IF EXISTS hkcms_user_token;
CREATE TABLE hkcms_user_token (
  token char(32) NOT NULL,
  user_id int NOT NULL,
  expire_time datetime DEFAULT NULL,
  create_time datetime DEFAULT NULL
) 
相关推荐
这个DBA有点耶12 分钟前
分组排名不用窗口函数?那你还在写几十行的子查询
前端·代码规范
ZhiqianXia15 分钟前
《The Design of Design》阅读笔记
前端·笔记·microsoft
有马贵将23 分钟前
【5】微前端知识点总结
前端·架构
mkae24 分钟前
eBPF高性能版fail2ban
前端
脑子进水养啥鱼?26 分钟前
PostgreSQL .history 文件
数据库·postgresql
_柴富自由26 分钟前
前端项目国际化解决方案
前端
isixe26 分钟前
Uniapp 监听回到前台并全局唯一弹窗
前端
qinqinzhang27 分钟前
Java 中的 IoC、AOP、MVC
java
禾叙_33 分钟前
【langchain4j】结构化输出(六)
java·开发语言
牛奶38 分钟前
AI双层代码治理:Monorepo × Harness Engineering
前端·aigc·ai编程