From bb987875fcc7be4733f24351f5c0fbc9dd33dd8e Mon Sep 17 00:00:00 2001 From: Romesum Date: Wed, 29 Apr 2020 14:12:24 +0800 Subject: [PATCH] =?UTF-8?q?[feat][M]:=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93sql=E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java/sql/lab_booking.sql | 217 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 java/sql/lab_booking.sql diff --git a/java/sql/lab_booking.sql b/java/sql/lab_booking.sql new file mode 100644 index 0000000..898f97a --- /dev/null +++ b/java/sql/lab_booking.sql @@ -0,0 +1,217 @@ +/* + Navicat Premium Data Transfer + + Source Server : ECS + Source Server Type : MySQL + Source Server Version : 50729 + Source Host : 47.93.196.88:3306 + Source Schema : lab_booking + + Target Server Type : MySQL + Target Server Version : 50729 + File Encoding : 65001 + + Date: 29/04/2020 13:55:32 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for tb_auth_group +-- ---------------------------- +DROP TABLE IF EXISTS `tb_auth_group`; +CREATE TABLE `tb_auth_group` ( + `group_id` int(11) NOT NULL 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; + +-- ---------------------------- +-- Records of tb_auth_group +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_auth_group_access +-- ---------------------------- +DROP TABLE IF EXISTS `tb_auth_group_access`; +CREATE TABLE `tb_auth_group_access` ( + `u_id` int(11) NOT NULL COMMENT '关联用户编号', + `group_id` int(11) NOT NULL COMMENT '关联用户组编号' +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of tb_auth_group_access +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_auth_rules +-- ---------------------------- +DROP TABLE IF EXISTS `tb_auth_rules`; +CREATE TABLE `tb_auth_rules` ( + `rules_id` int(11) NOT NULL 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; + +-- ---------------------------- +-- Records of tb_auth_rules +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_lab +-- ---------------------------- +DROP TABLE IF EXISTS `tb_lab`; +CREATE TABLE `tb_lab` ( + `lab_id` int(11) NOT NULL 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 '实验室容量', + `software` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实验室软件(英文逗号隔开)', + `manager_id` int(11) NULL DEFAULT NULL COMMENT '管理员用户编号', + `remind` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 (`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; + +-- ---------------------------- +-- Records of tb_lab +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_lab_record +-- ---------------------------- +DROP TABLE IF EXISTS `tb_lab_record`; +CREATE TABLE `tb_lab_record` ( + `lr_id` int(11) NOT NULL COMMENT '实验室预约记录编号', + `lt_id` int(11) NOT NULL COMMENT '实验室预约时间段编号', + `uc_id` int(11) NOT NULL COMMENT '预约用户编号', + `status` tinyint(4) NOT NULL COMMENT '实验室预约状态(0:审核中 1:审核失败 2:审核通过)', + `refuse_reason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `check_time` datetime(0) NULL DEFAULT NULL, + `create_time` datetime(0) NULL DEFAULT NULL, + `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; + +-- ---------------------------- +-- Records of tb_lab_record +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_lab_time +-- ---------------------------- +DROP TABLE IF EXISTS `tb_lab_time`; +CREATE TABLE `tb_lab_time` ( + `lt_id` int(11) NOT NULL 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 第一学期)', + `week` tinyint(2) NOT NULL COMMENT '实验室可预约周次(eg:1 第一周)', + `day` tinyint(1) NOT NULL COMMENT '实验室可预约星期几(eg:1 星期一)', + `time` tinyint(1) NOT NULL COMMENT '实验室可预约时间段(eg:1 第一-第二节课)', + `status` tinyint(4) NOT NULL COMMENT '实验室可预约时间段是否开启 0:关闭 1:开启', + `creator_id` int(11) NOT NULL COMMENT '创建者用户编号', + `remind` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci 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 (`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; + +-- ---------------------------- +-- Records of tb_lab_time +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_log +-- ---------------------------- +DROP TABLE IF EXISTS `tb_log`; +CREATE TABLE `tb_log` ( + `id` int(11) NOT NULL COMMENT '日志编号', + `u_id` int(11) NOT NULL COMMENT '用户编号', + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户访问的url', + `method` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户访问的method', + `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '用户访问传输的数据包(GET/POST)', + `option` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '对数据库的操作(CURD)', + `ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户访问时的IP', + `time` datetime(0) NULL DEFAULT NULL COMMENT '用户访问时间', + `mac` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户设备的MAC地址', + PRIMARY KEY (`id`) USING BTREE, + INDEX `u_id`(`u_id`) USING BTREE, + CONSTRAINT `tb_log_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; + +-- ---------------------------- +-- Records of tb_log +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_user +-- ---------------------------- +DROP TABLE IF EXISTS `tb_user`; +CREATE TABLE `tb_user` ( + `u_id` int(11) NOT NULL 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 '用户邮箱', + `college` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户所在二级学院', + `major` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户所在专业', + `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 '创建者用户编号', + `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; + +-- ---------------------------- +-- Records of tb_user +-- ---------------------------- + +-- ---------------------------- +-- Table structure for tb_user_course +-- ---------------------------- +DROP TABLE IF EXISTS `tb_user_course`; +CREATE TABLE `tb_user_course` ( + `uc_id` int(11) NOT NULL 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 '授课班级', + `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 '是否有课件(0:无,1:有)', + `create_time` datetime(0) NULL DEFAULT NULL, + `update_time` datetime(0) NULL DEFAULT NULL, + `delete_time` datetime(0) NULL DEFAULT NULL, + 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; + +-- ---------------------------- +-- Records of tb_user_course +-- ---------------------------- + +SET FOREIGN_KEY_CHECKS = 1;