/* Navicat Premium Data Transfer Source Server : shuix Source Server Type : MySQL Source Server Version : 80300 Source Host : localhost:3306 Source Schema : repair Target Server Type : MySQL Target Server Version : 80300 File Encoding : 65001 Date: 12/05/2024 18:16:03 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for address -- ---------------------------- DROP TABLE IF EXISTS `address`; CREATE TABLE `address` ( `address_id` int NOT NULL AUTO_INCREMENT COMMENT '地址 id', `address_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '地址名称', `is_parent` tinyint(1) NOT NULL COMMENT '是否是父地址', PRIMARY KEY (`address_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of address -- ---------------------------- -- ---------------------------- -- Table structure for admin_user -- ---------------------------- DROP TABLE IF EXISTS `admin_user`; CREATE TABLE `admin_user` ( `admin_id` int NOT NULL AUTO_INCREMENT COMMENT '用户 id', `admin_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名', `admin_pass` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码', `admin_group` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户组', PRIMARY KEY (`admin_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of admin_user -- ---------------------------- -- ---------------------------- -- Table structure for device -- ---------------------------- DROP TABLE IF EXISTS `device`; CREATE TABLE `device` ( `device_id` int NOT NULL COMMENT '设备id', `device_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备名称', `device_status` tinyint(1) NOT NULL COMMENT '设备状态', `device_type_id` int NOT NULL COMMENT '设备分类 id', `device_address_id` int NOT NULL COMMENT '设备地址 id', `device_address_detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备详细地址', `device_img` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备图片', `create_time` datetime NOT NULL COMMENT '创建时间', `update_time` datetime NOT NULL COMMENT '更新时间', PRIMARY KEY (`device_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of device -- ---------------------------- -- ---------------------------- -- Table structure for fault -- ---------------------------- DROP TABLE IF EXISTS `fault`; CREATE TABLE `fault` ( `fault_id` int NOT NULL AUTO_INCREMENT COMMENT '故障 id', `fault_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '故障名称', PRIMARY KEY (`fault_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of fault -- ---------------------------- -- ---------------------------- -- Table structure for material -- ---------------------------- DROP TABLE IF EXISTS `material`; CREATE TABLE `material` ( `material_id` int NOT NULL AUTO_INCREMENT COMMENT '材料 id', `material_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '材料名称', `material_num` int NOT NULL COMMENT '材料数量', `create_time` datetime NOT NULL COMMENT '创建时间', `update_time` datetime NOT NULL COMMENT '更新时间', PRIMARY KEY (`material_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of material -- ---------------------------- -- ---------------------------- -- Table structure for message -- ---------------------------- DROP TABLE IF EXISTS `message`; CREATE TABLE `message` ( `message_id` int NOT NULL AUTO_INCREMENT COMMENT '消息 id', `message_content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '消息内容 ', `student_id` int NULL DEFAULT NULL COMMENT '学生 id', `worker_id` int NULL DEFAULT NULL COMMENT '工人 id', `message_status` tinyint(1) NOT NULL COMMENT '消息状态', `create_time` datetime NOT NULL COMMENT '创建时间', `read_time` datetime NULL DEFAULT NULL COMMENT '已读时间', PRIMARY KEY (`message_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of message -- ---------------------------- -- ---------------------------- -- Table structure for order -- ---------------------------- DROP TABLE IF EXISTS `order`; CREATE TABLE `order` ( `order_id` int NOT NULL AUTO_INCREMENT COMMENT '维修表单 id', `student_id` int NOT NULL COMMENT '学生 id', `worker_id` int NULL DEFAULT NULL COMMENT '工人 id', `device_id` int NOT NULL COMMENT '设备 id', `contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系人名称', `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '联系电话', `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '详细地点', `fault_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '故障描述', `fault_img` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '故障图片', `order_status` tinyint(1) NOT NULL COMMENT '维修单状态', `create_time` datetime NOT NULL COMMENT '创建时间', `finish_time` datetime NULL DEFAULT NULL COMMENT '完成时间', PRIMARY KEY (`order_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of order -- ---------------------------- -- ---------------------------- -- Table structure for stu -- ---------------------------- DROP TABLE IF EXISTS `stu`; CREATE TABLE `stu` ( `user_id` int NOT NULL AUTO_INCREMENT COMMENT '用户 id', `user_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '学工号', `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名', `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码 ', `gender` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '性别', `regip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '注册 ip', `status` tinyint(1) NOT NULL COMMENT '用户状态 ', `regtime` datetime NOT NULL COMMENT '注册时间', `update_time` datetime NOT NULL COMMENT '修改时间', PRIMARY KEY (`user_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of stu -- ---------------------------- -- ---------------------------- -- Table structure for worker -- ---------------------------- DROP TABLE IF EXISTS `worker`; CREATE TABLE `worker` ( `user_id` int NOT NULL AUTO_INCREMENT COMMENT '用户 id', `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名', `user_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '工号', `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码 ', `gender` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '性别 ', `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '电话号码', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', `status` tinyint(1) NOT NULL COMMENT '状态', `order_status` tinyint(1) NOT NULL COMMENT '接单状态', `satisfaction` float NOT NULL COMMENT '用户满意度', `order_num` int NOT NULL COMMENT '接单数', PRIMARY KEY (`user_id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Records of worker -- ---------------------------- SET FOREIGN_KEY_CHECKS = 1;