[fix][M]:完善数据库结构

master
Romesum 5 years ago
parent 46e5d9c68d
commit ff87670606

@ -11,7 +11,7 @@
Target Server Version : 50729
File Encoding : 65001
Date: 29/04/2020 13:55:32
Date: 29/04/2020 17:02:55
*/
SET NAMES utf8mb4;
@ -22,12 +22,12 @@ SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
DROP TABLE IF EXISTS `tb_auth_group`;
CREATE TABLE `tb_auth_group` (
`group_id` int(11) NOT NULL COMMENT '用户组编号',
`group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户组编号',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户组名称',
`rules_id` int(11) NULL DEFAULT NULL COMMENT '规则编号(用逗号隔开)',
`status` tinyint(4) NOT NULL COMMENT '用户组状态 0关闭 1开启',
PRIMARY KEY (`group_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_auth_group
@ -51,12 +51,12 @@ CREATE TABLE `tb_auth_group_access` (
-- ----------------------------
DROP TABLE IF EXISTS `tb_auth_rules`;
CREATE TABLE `tb_auth_rules` (
`rules_id` int(11) NOT NULL COMMENT '规则编号',
`rules_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '规则编号',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则名称',
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则地址',
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则状态 0关闭 1开启',
PRIMARY KEY (`rules_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_auth_rules
@ -67,7 +67,7 @@ CREATE TABLE `tb_auth_rules` (
-- ----------------------------
DROP TABLE IF EXISTS `tb_lab`;
CREATE TABLE `tb_lab` (
`lab_id` int(11) NOT NULL COMMENT '实验室编号',
`lab_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '实验室编号',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实验室名称',
`position` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实验室位置',
`capacity` int(11) NULL DEFAULT NULL COMMENT '实验室容量',
@ -78,9 +78,8 @@ CREATE TABLE `tb_lab` (
`update_time` datetime(0) NULL DEFAULT NULL,
`delete_time` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`lab_id`) USING BTREE,
INDEX `tb_lab_ibfk_1`(`manager_id`) USING BTREE,
CONSTRAINT `tb_lab_ibfk_1` FOREIGN KEY (`manager_id`) REFERENCES `tb_user` (`u_id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
INDEX `tb_lab_ibfk_1`(`manager_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_lab
@ -91,7 +90,7 @@ CREATE TABLE `tb_lab` (
-- ----------------------------
DROP TABLE IF EXISTS `tb_lab_record`;
CREATE TABLE `tb_lab_record` (
`lr_id` int(11) NOT NULL COMMENT '实验室预约记录编号',
`lr_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '实验室预约记录编号',
`lt_id` int(11) NOT NULL COMMENT '实验室预约时间段编号',
`uc_id` int(11) NOT NULL COMMENT '预约用户编号',
`status` tinyint(4) NOT NULL COMMENT '实验室预约状态0审核中 1审核失败 2审核通过',
@ -101,11 +100,10 @@ CREATE TABLE `tb_lab_record` (
`update_time` datetime(0) NULL DEFAULT NULL,
`delete_time` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`lr_id`) USING BTREE,
INDEX `u_id`(`uc_id`) USING BTREE,
UNIQUE INDEX `tb_lab_record_ibfk_1`(`lt_id`) USING BTREE,
CONSTRAINT `tb_lab_record_ibfk_1` FOREIGN KEY (`lt_id`) REFERENCES `tb_lab_time` (`lt_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `tb_lab_record_ibfk_2` FOREIGN KEY (`uc_id`) REFERENCES `tb_user` (`u_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
INDEX `tb_lab_record_ibfk_2`(`uc_id`) USING BTREE,
CONSTRAINT `tb_lab_record_ibfk_3` FOREIGN KEY (`lt_id`) REFERENCES `tb_lab_time` (`lt_id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_lab_record
@ -116,7 +114,7 @@ CREATE TABLE `tb_lab_record` (
-- ----------------------------
DROP TABLE IF EXISTS `tb_lab_time`;
CREATE TABLE `tb_lab_time` (
`lt_id` int(11) NOT NULL COMMENT '实验室预约时间段编号',
`lt_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '实验室预约时间段编号',
`lab_id` int(11) NOT NULL COMMENT '实验室编号',
`year` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '实验室预约时间段所在学年eg:2019 2019-2020学年',
`semester` tinyint(1) NOT NULL COMMENT '实验室可预约学期(eg:1 第一学期)',
@ -131,8 +129,10 @@ CREATE TABLE `tb_lab_time` (
`delete_time` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`lt_id`) USING BTREE,
INDEX `tb_lab_time_ibfk_1`(`lab_id`) USING BTREE,
CONSTRAINT `tb_lab_time_ibfk_1` FOREIGN KEY (`lab_id`) REFERENCES `tb_lab` (`lab_id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
INDEX `creator_id`(`creator_id`) USING BTREE,
CONSTRAINT `tb_lab_time_ibfk_1` FOREIGN KEY (`lab_id`) REFERENCES `tb_lab` (`lab_id`) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT `tb_lab_time_ibfk_2` FOREIGN KEY (`creator_id`) REFERENCES `tb_user` (`u_id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_lab_time
@ -166,7 +166,7 @@ CREATE TABLE `tb_log` (
-- ----------------------------
DROP TABLE IF EXISTS `tb_user`;
CREATE TABLE `tb_user` (
`u_id` int(11) NOT NULL COMMENT '用户编号',
`u_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
`nickname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户昵称(一般用真实姓名)',
`tel` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户电话',
`email` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户邮箱',
@ -175,12 +175,12 @@ CREATE TABLE `tb_user` (
`username` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名(工号)',
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户密码(加密)',
`office` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户所在办公室',
`creator_id` int(11) NOT NULL COMMENT '创建者用户编号',
`creator_id` int(11) NULL DEFAULT NULL COMMENT '创建者用户编号',
`create_time` datetime(0) NULL DEFAULT NULL,
`update_time` datetime(0) NULL DEFAULT NULL,
`delete_time` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`u_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_user
@ -191,14 +191,14 @@ CREATE TABLE `tb_user` (
-- ----------------------------
DROP TABLE IF EXISTS `tb_user_course`;
CREATE TABLE `tb_user_course` (
`uc_id` int(11) NOT NULL COMMENT '课程编号',
`uc_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '课程编号',
`u_id` int(11) NOT NULL COMMENT '老师编号',
`name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
`software` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '软件名称',
`year` char(4) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程所在学年',
`semester` tinyint(4) NOT NULL COMMENT '课程所在学期',
`population` int(255) NULL DEFAULT NULL COMMENT '授课人数',
`class` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '授课班级',
`classes` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '授课班级',
`remind` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`status` tinyint(4) NULL DEFAULT NULL COMMENT '状态(拓展)',
`isHaveDocuments` tinyint(4) NULL DEFAULT NULL COMMENT '是否有课件01',
@ -208,7 +208,7 @@ CREATE TABLE `tb_user_course` (
PRIMARY KEY (`uc_id`) USING BTREE,
INDEX `u_id`(`u_id`) USING BTREE,
CONSTRAINT `tb_user_course_ibfk_1` FOREIGN KEY (`u_id`) REFERENCES `tb_user` (`u_id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of tb_user_course

Loading…
Cancel
Save