权限设置页面和表设计

/*
 Navicat Premium Data Transfer

 Date: 23/10/2019 13:56:29
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for GroupRole
-- ----------------------------
DROP TABLE IF EXISTS `GroupRole`;
CREATE TABLE `GroupRole`  (
  `Id` int(11) NOT NULL,
  `GroupId` int(11) NOT NULL COMMENT '用户组ID',
  `RoleId` int(11) NOT NULL COMMENT '角色ID',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `GroupId_RoleId`(`GroupId`, `RoleId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户组与角色关联' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for Groups
-- ----------------------------
DROP TABLE IF EXISTS `Groups`;
CREATE TABLE `Groups`  (
  `Id` int(11) NOT NULL,
  `GroupName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户组名',
  `OrderBy` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  `Remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除,2禁用',
  PRIMARY KEY (`Id`) USING BTREE,
  INDEX `GroupName`(`GroupName`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户组' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for Module
-- ----------------------------
DROP TABLE IF EXISTS `Module`;
CREATE TABLE `Module`  (
  `Id` int(11) NOT NULL,
  `ParentId` int(11) NOT NULL COMMENT '父级Id',
  `ModuleName` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块名称',
  `PowerName` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名称',
  `NavCls` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标标识CSS',
  `ModuleType` int(11) NOT NULL DEFAULT 0 COMMENT '模块类型,1菜单,2功能',
  `Url` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '路径',
  `OrderBy` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
  `Remark` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `Code` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '模块编码,可作唯一标识',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除,2禁用',
  `IsHome` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否在首页显示',
  PRIMARY KEY (`Id`) USING BTREE,
  INDEX `ParentId`(`ParentId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '权限模块' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for Role
-- ----------------------------
DROP TABLE IF EXISTS `Role`;
CREATE TABLE `Role`  (
  `Id` int(11) NOT NULL,
  `RoleName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '角色名称',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  `OrderBy` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
  `Remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`Id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for RoleModule
-- ----------------------------
DROP TABLE IF EXISTS `RoleModule`;
CREATE TABLE `RoleModule`  (
  `Id` int(11) NOT NULL,
  `RoleId` int(11) NOT NULL COMMENT '角色Id',
  `ModuleId` int(11) NOT NULL COMMENT '模块Id',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `RoleId_ModuleId`(`RoleId`, `ModuleId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '角色与模块关联' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for User
-- ----------------------------
DROP TABLE IF EXISTS `User`;
CREATE TABLE `User`  (
  `Id` int(11) NOT NULL COMMENT '用户Id',
  `UserName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户账号',
  `Password` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '登录密码',
  `Salt` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '随机Guid',
  `UserType` int(11) NOT NULL DEFAULT 0 COMMENT '用户类型,1超管',
  `Email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
  `RealName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名(用户真实名)',
  `Phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号码',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除,2禁用',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  `Remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `LoginTime` datetime(0) NULL DEFAULT NULL COMMENT '最新登录时间',
  `IP` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '最新登录IP',
  `LastLoginTime` datetime(0) NULL DEFAULT NULL COMMENT '上次登录时间',
  `LastIP` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上次登录IP',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `UserName`(`UserName`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for UserGroup
-- ----------------------------
DROP TABLE IF EXISTS `UserGroup`;
CREATE TABLE `UserGroup`  (
  `Id` int(11) NOT NULL,
  `UserId` int(11) NOT NULL COMMENT '用户Id',
  `GroupId` int(11) NOT NULL COMMENT '用户组Id',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `UserId_GroupId`(`UserId`, `GroupId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户与用户组关联' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for UserModule
-- ----------------------------
DROP TABLE IF EXISTS `UserModule`;
CREATE TABLE `UserModule`  (
  `Id` int(11) NOT NULL,
  `UserId` int(11) NOT NULL COMMENT '用户Id',
  `ModuleId` int(11) NOT NULL COMMENT '模块Id',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `UserId_ModuleId`(`UserId`, `ModuleId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户与模块关联' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for UserRole
-- ----------------------------
DROP TABLE IF EXISTS `UserRole`;
CREATE TABLE `UserRole`  (
  `Id` int(11) NOT NULL,
  `UserId` int(11) NOT NULL COMMENT '用户Id',
  `RoleId` int(11) NOT NULL COMMENT '角色Id',
  `Status` int(11) NOT NULL DEFAULT 0 COMMENT '状态,0正常,1已删除',
  `Creator` int(11) NOT NULL DEFAULT 0 COMMENT '创建人',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `Reviser` int(11) NOT NULL DEFAULT 0 COMMENT '修改人',
  `ReviseTime` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `UserId_RoleId`(`UserId`, `RoleId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户与角色关联' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for UserToken
-- ----------------------------
DROP TABLE IF EXISTS `UserToken`;
CREATE TABLE `UserToken`  (
  `Id` bigint(20) NOT NULL,
  `Token` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '令牌',
  `UserId` int(11) NOT NULL DEFAULT 0 COMMENT '用户ID',
  `CreateTime` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '登录时间戳',
  PRIMARY KEY (`Id`) USING BTREE,
  UNIQUE INDEX `Token`(`Token`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户登录令牌' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

 

 
posted @ 2019-08-22 15:11  cclon  阅读(1838)  评论(0编辑  收藏  举报