【研究中】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
) 
相关推荐
成都渲染101云渲染66663 小时前
如何在3ds Max中实现更快、更高质量的渲染
前端·javascript·人工智能
闲猫5 小时前
Spring AI 对接Deepseek ChatModel 聊天对话
java·前端·spring
不像程序员的程序媛6 小时前
系统cpu内存负载资源分析
运维·服务器·数据库
Jane Chiu7 小时前
Oracle DBMS_REDEFINITION(在线重定义)
数据库·oracle·分区表
自信的未来7 小时前
JSON 工具|Web Worker 工程化打包 + 语法自动修复 + 多语言代码生成实战
java·前端·json
Brookty7 小时前
【JavaEE】线程安全(一).4:写块串行保安全、CAS
java·开发语言·java-ee·多线程·线程安全
全栈前端老曹7 小时前
【MongoDB】安全与权限管理 —— 用户认证、角色权限、SSL 加密
前端·javascript·数据库·安全·mongodb·nosql·ssl
怕孤单的草丛7 小时前
缓存管理面临的主要问题
java·数据库·缓存
我会尽全力 乐观而坚强8 小时前
MySQL零基础入门(二)
数据库·mysql·adb