/*
 Navicat Premium Data Transfer

 Source Server         : 607ietm
 Source Server Type    : MySQL
 Source Server Version : 80405 (8.4.5)
 Source Host           : 101.35.140.199:13306
 Source Schema         : ietm

 Target Server Type    : MySQL
 Target Server Version : 80405 (8.4.5)
 File Encoding         : 65001

 Date: 13/01/2026 15:42:23
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for course
-- ----------------------------
DROP TABLE IF EXISTS `course`;
CREATE TABLE `course`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '课程ID',
  `course_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程名称',
  `course_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '课程编码',
  `course_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '课程描述',
  `course_category` int NULL DEFAULT NULL COMMENT '课程分类',
  `course_ico` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '课程封面',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `course_code`(`course_code` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '课程表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of course
-- ----------------------------
INSERT INTO `course` VALUES (1, 'ico1.jpg', 'csgo', 'csgo', 1, '/home/quella/src/img/ico');

-- ----------------------------
-- Table structure for course_type
-- ----------------------------
DROP TABLE IF EXISTS `course_type`;
CREATE TABLE `course_type`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `typeName` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型名称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of course_type
-- ----------------------------
INSERT INTO `course_type` VALUES (1, '游戏');

-- ----------------------------
-- Table structure for dept
-- ----------------------------
DROP TABLE IF EXISTS `dept`;
CREATE TABLE `dept`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '部门唯一标识',
  `dept_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '部门名称',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `dept_name`(`dept_name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '部门表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of dept
-- ----------------------------
INSERT INTO `dept` VALUES (1, '动漫部');
INSERT INTO `dept` VALUES (4, '商场逛街讨论部');
INSERT INTO `dept` VALUES (2, '电子竞技部门');
INSERT INTO `dept` VALUES (3, '电视剧观赏部');

-- ----------------------------
-- Table structure for device
-- ----------------------------
DROP TABLE IF EXISTS `device`;
CREATE TABLE `device`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '设备唯一标识',
  `device_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备编码',
  `device_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备名称',
  `device_status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备状态',
  `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备型号',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `device_code`(`device_code` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '设备表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of device
-- ----------------------------

-- ----------------------------
-- Table structure for exam_paper
-- ----------------------------
DROP TABLE IF EXISTS `exam_paper`;
CREATE TABLE `exam_paper`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '试卷ID',
  `paper_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷名称',
  `paper_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '试卷编码',
  `paper_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '试卷描述',
  `total_score` int NOT NULL DEFAULT 100 COMMENT '总分',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `paper_code`(`paper_code` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '试卷表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of exam_paper
-- ----------------------------

-- ----------------------------
-- Table structure for fault_event
-- ----------------------------
DROP TABLE IF EXISTS `fault_event`;
CREATE TABLE `fault_event`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '故障事件ID',
  `event_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '事件编码',
  `device_id` bigint NOT NULL COMMENT '设备ID',
  `part_id` bigint NULL DEFAULT NULL COMMENT '部件ID',
  `fault_item_id` bigint NULL DEFAULT NULL COMMENT '故障条目ID',
  `occur_time` datetime NOT NULL COMMENT '发生时间',
  `phenomenon_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '故障现象',
  `reason_analysis` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '原因分析',
  `processing_measures` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '处理措施',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `event_code`(`event_code` ASC) USING BTREE,
  INDEX `fk_event_device`(`device_id` ASC) USING BTREE,
  INDEX `fk_event_part`(`part_id` ASC) USING BTREE,
  INDEX `fk_event_fault`(`fault_item_id` ASC) USING BTREE,
  CONSTRAINT `fk_event_device` FOREIGN KEY (`device_id`) REFERENCES `device` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_event_fault` FOREIGN KEY (`fault_item_id`) REFERENCES `fault_item` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_event_part` FOREIGN KEY (`part_id`) REFERENCES `part` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '故障事件表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of fault_event
-- ----------------------------

-- ----------------------------
-- Table structure for fault_item
-- ----------------------------
DROP TABLE IF EXISTS `fault_item`;
CREATE TABLE `fault_item`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '故障条目ID',
  `fault_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '故障代码',
  `fault_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '故障名称',
  `fault_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '故障描述',
  `device_id` bigint NOT NULL COMMENT '设备ID',
  `part_id` bigint NULL DEFAULT NULL COMMENT '部件ID',
  `creator_id` bigint NOT NULL COMMENT '创建人ID',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `fault_code`(`fault_code` ASC) USING BTREE,
  INDEX `fk_fault_device`(`device_id` ASC) USING BTREE,
  INDEX `fk_fault_part`(`part_id` ASC) USING BTREE,
  INDEX `fk_fault_user`(`creator_id` ASC) USING BTREE,
  CONSTRAINT `fk_fault_device` FOREIGN KEY (`device_id`) REFERENCES `device` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_fault_part` FOREIGN KEY (`part_id`) REFERENCES `part` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_fault_user` FOREIGN KEY (`creator_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '故障条目表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of fault_item
-- ----------------------------

-- ----------------------------
-- Table structure for model_file
-- ----------------------------
DROP TABLE IF EXISTS `model_file`;
CREATE TABLE `model_file`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '模型文件ID',
  `part_id` bigint NOT NULL COMMENT '关联部件ID',
  `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件名',
  `file_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件路径',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_model_part`(`part_id` ASC) USING BTREE,
  CONSTRAINT `fk_model_part` FOREIGN KEY (`part_id`) REFERENCES `part` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '模型文件表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of model_file
-- ----------------------------

-- ----------------------------
-- Table structure for part
-- ----------------------------
DROP TABLE IF EXISTS `part`;
CREATE TABLE `part`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '部件唯一标识',
  `part_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '部件编码',
  `part_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '部件名称',
  `device_id` bigint NOT NULL COMMENT '所属设备ID',
  `part_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '部件描述',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `part_code`(`part_code` ASC) USING BTREE,
  INDEX `fk_part_device`(`device_id` ASC) USING BTREE,
  CONSTRAINT `fk_part_device` FOREIGN KEY (`device_id`) REFERENCES `device` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '部件表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of part
-- ----------------------------

-- ----------------------------
-- Table structure for training_resource
-- ----------------------------
DROP TABLE IF EXISTS `training_resource`;
CREATE TABLE `training_resource`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '资源ID',
  `resource_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '资源名称',
  `resource_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '资源类型',
  `file_path` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件路径',
  `course_id` bigint NOT NULL COMMENT '课程ID',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_resource_course`(`course_id` ASC) USING BTREE,
  CONSTRAINT `fk_resource_course` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '培训资源表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of training_resource
-- ----------------------------

-- ----------------------------
-- Table structure for troubleshoot_node
-- ----------------------------
DROP TABLE IF EXISTS `troubleshoot_node`;
CREATE TABLE `troubleshoot_node`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '流程节点ID',
  `fault_item_id` bigint NOT NULL COMMENT '故障条目ID',
  `step_order` int NOT NULL COMMENT '步骤顺序号',
  `step_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '步骤名称',
  `step_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '步骤描述',
  `check_items` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '检查项',
  `measurement_point` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '测量点参考值',
  `judge_standard` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '判断标准',
  `next_node_id` bigint NULL DEFAULT NULL COMMENT '下一节点ID',
  `branch_condition` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分支条件',
  `is_leaf` tinyint NOT NULL DEFAULT 0 COMMENT '是否叶子节点',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_node_fault`(`fault_item_id` ASC) USING BTREE,
  INDEX `fk_node_next`(`next_node_id` ASC) USING BTREE,
  CONSTRAINT `fk_node_fault` FOREIGN KEY (`fault_item_id`) REFERENCES `fault_item` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_node_next` FOREIGN KEY (`next_node_id`) REFERENCES `troubleshoot_node` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '排故流程节点表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of troubleshoot_node
-- ----------------------------

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户唯一标识',
  `username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录用户名',
  `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录密码',
  `real_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户真实姓名',
  `dept_id` int NULL DEFAULT NULL COMMENT '部门id',
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `role` int NOT NULL COMMENT ' 用户角色:1--管理员,2--普通用户',
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '用户状态(1启用 0禁用)',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `last_login_time` datetime NULL DEFAULT NULL COMMENT '最后登录时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `username`(`username` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (8, 'ttk', '$2a$10$m2LFIGpEqrlnj6Oy/rI6W.2I5hb0Fnxui.baK2a/LY.12.f3Hows6', 'ttk', 1, '19850166220', 2, 1, '2026-01-13 13:01:38', '2026-01-13 13:17:34');

-- ----------------------------
-- Table structure for user_exam_score
-- ----------------------------
DROP TABLE IF EXISTS `user_exam_score`;
CREATE TABLE `user_exam_score`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '成绩ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `paper_id` bigint NOT NULL COMMENT '试卷ID',
  `score` int NOT NULL COMMENT '考试得分',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_user_paper`(`user_id` ASC, `paper_id` ASC) USING BTREE,
  INDEX `fk_score_paper`(`paper_id` ASC) USING BTREE,
  CONSTRAINT `fk_score_paper` FOREIGN KEY (`paper_id`) REFERENCES `exam_paper` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_score_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户考试成绩表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of user_exam_score
-- ----------------------------

-- ----------------------------
-- Table structure for user_learning_record
-- ----------------------------
DROP TABLE IF EXISTS `user_learning_record`;
CREATE TABLE `user_learning_record`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '学习记录ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `course_id` bigint NOT NULL COMMENT '课程ID',
  `resource_id` bigint NOT NULL COMMENT '资源ID',
  `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '学习状态',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_lr_user`(`user_id` ASC) USING BTREE,
  INDEX `fk_lr_course`(`course_id` ASC) USING BTREE,
  INDEX `fk_lr_resource`(`resource_id` ASC) USING BTREE,
  CONSTRAINT `fk_lr_course` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_lr_resource` FOREIGN KEY (`resource_id`) REFERENCES `training_resource` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_lr_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户学习记录表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of user_learning_record
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;
