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




--更新时间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
) 







猜你喜欢

转载自blog.csdn.net/zgscwxd/article/details/134633860