【研究中】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
) 
相关推荐
mCell16 小时前
GSAP ScrollTrigger 详解
前端·javascript·动效
gnip16 小时前
Node.js 子进程:child_process
前端·javascript
RainbowSea18 小时前
12. LangChain4j + 向量数据库操作详细说明
java·langchain·ai编程
RainbowSea19 小时前
11. LangChain4j + Tools(Function Calling)的使用详细说明
java·langchain·ai编程
excel19 小时前
为什么在 Three.js 中平面能产生“起伏效果”?
前端
excel20 小时前
Node.js 断言与测试框架示例对比
前端
天蓝色的鱼鱼1 天前
前端开发者的组件设计之痛:为什么我的组件总是难以维护?
前端·react.js
codingandsleeping1 天前
使用orval自动拉取swagger文档并生成ts接口
前端·javascript
考虑考虑1 天前
Jpa使用union all
java·spring boot·后端
石金龙1 天前
[译] Composition in CSS
前端·css