/*
 Navicat Premium Data Transfer

 Source Server         : hxh
 Source Server Type    : MySQL
 Source Server Version : 80017
 Source Host           : localhost:3306
 Source Schema         : base-in-back-end

 Target Server Type    : MySQL
 Target Server Version : 80017
 File Encoding         : 65001

 Date: 23/09/2020 20:46:33
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for paper
-- ----------------------------
DROP TABLE IF EXISTS `paper`;
CREATE TABLE `paper`  (
                          `id` int(11) NOT NULL AUTO_INCREMENT,
                          `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '试卷名',
                          `subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '试卷学科',
                          `groupName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年级分类',
                          `gradeName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '年级',
                          `type` int(11) NULL DEFAULT NULL COMMENT '试卷类型（1为练习，2为考试）',
                          PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of paper
-- ----------------------------
INSERT INTO `paper` VALUES (1, '数学1', '数学', '小学', '一年级', 1);
INSERT INTO `paper` VALUES (2, '1', '1', '1', '1', 1);
INSERT INTO `paper` VALUES (3, '2', '2', '3', '2', 2);
INSERT INTO `paper` VALUES (4, '3', '2', '2', '2', 2);
INSERT INTO `paper` VALUES (5, '5', '55', '5', '5', 5);
INSERT INTO `paper` VALUES (6, 'sss', '数学', '小学', '一年级', 1);

-- ----------------------------
-- Table structure for paper_item
-- ----------------------------
DROP TABLE IF EXISTS `paper_item`;
CREATE TABLE `paper_item`  (
                               `id` int(11) NOT NULL AUTO_INCREMENT,
                               `pid` int(11) NULL DEFAULT NULL COMMENT 'paper主键',
                               `sid` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                               PRIMARY KEY (`id`) USING BTREE,
                               INDEX `paperId外加按`(`pid`) USING BTREE,
                               CONSTRAINT `paperId外加按` FOREIGN KEY (`pid`) REFERENCES `paper` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of paper_item
-- ----------------------------
INSERT INTO `paper_item` VALUES (1, 1, '755191767824859136');
INSERT INTO `paper_item` VALUES (2, 1, '755116421201002496');
INSERT INTO `paper_item` VALUES (3, 1, '746404364570066944');
INSERT INTO `paper_item` VALUES (4, 1, '746404343267196928');
INSERT INTO `paper_item` VALUES (5, 1, '746404354461794304');
INSERT INTO `paper_item` VALUES (6, 1, '746404357817237504');
INSERT INTO `paper_item` VALUES (7, 1, '746404370169462784');

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
                         `id` int(11) NOT NULL AUTO_INCREMENT,
                         `username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                         `password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                         `nickname` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                         PRIMARY KEY (`id`) USING BTREE,
                         UNIQUE INDEX `账号唯一`(`username`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1, 'xiaoming', '123456', '小明');
INSERT INTO `user` VALUES (2, 'xiaochen', '2121', '2323');

-- ----------------------------
-- Table structure for wrongbook
-- ----------------------------
DROP TABLE IF EXISTS `wrongbook`;
CREATE TABLE `wrongbook`  (
                              `groupName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                              `gradeName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                              `subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
                              `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                              `description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                              `uid` int(11) NOT NULL,
                              PRIMARY KEY (`groupName`, `gradeName`, `subject`, `uid`) USING BTREE,
                              INDEX `user外键`(`uid`) USING BTREE,
                              INDEX `groupName`(`groupName`) USING BTREE,
                              INDEX `gradeName`(`gradeName`) USING BTREE,
                              INDEX `subject`(`subject`) USING BTREE,
                              CONSTRAINT `user外键` FOREIGN KEY (`uid`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of wrongbook
-- ----------------------------
INSERT INTO `wrongbook` VALUES ('小学', '一年级', '数学', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '一年级', '英语', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '一年级', '语文', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '三年级', '数学', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '三年级', '英语', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '三年级', '语文', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '二年级', '数学', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '二年级', '英语', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '二年级', '语文', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '五年级', '数学', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '五年级', '英语', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '五年级', '语文', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '六年级', '数学', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '六年级', '英语', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '六年级', '语文', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '四年级', '数学', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '四年级', '英语', '数学1', '记录错题', 1);
INSERT INTO `wrongbook` VALUES ('小学', '四年级', '语文', '数学1', '记录错题', 1);

-- ----------------------------
-- Table structure for wrongbook_item
-- ----------------------------
DROP TABLE IF EXISTS `wrongbook_item`;
CREATE TABLE `wrongbook_item`  (
                                   `id` int(11) NOT NULL AUTO_INCREMENT,
                                   `sid` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                   `groupName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                   `gradeName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                   `subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                   `uid` int(11) NULL DEFAULT NULL,
                                   PRIMARY KEY (`id`) USING BTREE,
                                   INDEX `groupName外键`(`groupName`) USING BTREE,
                                   INDEX `gradeName外键`(`gradeName`) USING BTREE,
                                   INDEX `subject外键`(`subject`) USING BTREE,
                                   INDEX `uid外键`(`uid`) USING BTREE,
                                   CONSTRAINT `gradeName外键` FOREIGN KEY (`gradeName`) REFERENCES `wrongbook` (`gradeName`) ON DELETE RESTRICT ON UPDATE RESTRICT,
                                   CONSTRAINT `groupName外键` FOREIGN KEY (`groupName`) REFERENCES `wrongbook` (`groupName`) ON DELETE RESTRICT ON UPDATE RESTRICT,
                                   CONSTRAINT `subject外键` FOREIGN KEY (`subject`) REFERENCES `wrongbook` (`subject`) ON DELETE RESTRICT ON UPDATE RESTRICT,
                                   CONSTRAINT `uid外键` FOREIGN KEY (`uid`) REFERENCES `wrongbook` (`uid`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of wrongbook_item
-- ----------------------------
INSERT INTO `wrongbook_item` VALUES (1, '755191767824859136', '小学', '一年级', '数学', 1);
INSERT INTO `wrongbook_item` VALUES (12, '755116420047568896', '小学', '一年级', '数学', 1);

SET FOREIGN_KEY_CHECKS = 1;
