【研究中】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
) 
相关推荐
wyn20001128几秒前
JavaWeb的一些基础技术
前端
从零开始学习人工智能13 分钟前
Doris 数据库深度解析:架构、原理与实战应用
数据库·架构
Hygge-star14 分钟前
Flask音频处理:构建高效的Web音频应用指南
前端·flask·音视频·pygame·csdn开发云
江城开朗的豌豆25 分钟前
JavaScript篇:回调地狱退散!6年老前端教你写出优雅异步代码
前端·javascript·面试
大春儿的试验田30 分钟前
Parameter ‘XXX‘ not found. Available parameters are [list, param1]
java
飞鸟malred37 分钟前
vite+tailwind封装组件库
前端·react.js·npm
Angindem39 分钟前
从零搭建uniapp项目
前端·vue.js·uni-app
java干货1 小时前
深度解析:Spring Boot 配置加载顺序、优先级与 bootstrap 上下文
前端·spring boot·bootstrap
LiRuiJie1 小时前
深入剖析MySQL锁机制,多事务并发场景锁竞争
数据库·mysql
2501_915374351 小时前
Faiss向量数据库全面解析:从原理到实战
数据库·faiss