/*
 Navicat Premium Dump SQL

 Source Server         : GRS
 Source Server Type    : MySQL
 Source Server Version : 80039 (8.0.39)
 Source Host           : localhost:3306
 Source Schema         : distribution

 Target Server Type    : MySQL
 Target Server Version : 80039 (8.0.39)
 File Encoding         : 65001

 Date: 01/11/2024 16:28:33
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for address
-- ----------------------------
DROP TABLE IF EXISTS `address`;
CREATE TABLE `address`  (
  `id` bigint NOT NULL COMMENT '地址id',
  `user_id` bigint NOT NULL COMMENT '用户id',
  `address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '地址',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `address_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of address
-- ----------------------------
INSERT INTO `address` VALUES (1848323292988100610, 1848316858330193922, '福建省福州市仓山区上三路83号程埔市场二期807单元');
INSERT INTO `address` VALUES (1848533495658516482, 1848316858330193922, '福建省福州市鼓楼区洪山镇杨桥西路50号福州大学至诚学院');

-- ----------------------------
-- Table structure for code
-- ----------------------------
DROP TABLE IF EXISTS `code`;
CREATE TABLE `code`  (
  `id` bigint NOT NULL COMMENT '取件码id',
  `goods_id` bigint NOT NULL COMMENT '快递id',
  `claim` varchar(24) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '快递取件码',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `claim`(`claim` ASC) USING BTREE,
  INDEX `goods_id`(`goods_id` ASC) USING BTREE,
  CONSTRAINT `code_ibfk_1` FOREIGN KEY (`goods_id`) REFERENCES `goods` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of code
-- ----------------------------
INSERT INTO `code` VALUES (1848543466148241409, 1848543466089521153, 'YT20241022095441280761');
INSERT INTO `code` VALUES (1848543555377864707, 1848543555310755841, 'YT20241022095502ba779d');
INSERT INTO `code` VALUES (1848543604971315203, 1848543604904206338, 'YT20241022095514d79301');
INSERT INTO `code` VALUES (1848543646071300098, 1848543645941276674, 'YT20241022095524a92edc');
INSERT INTO `code` VALUES (1848544752541249538, 1848544752499306498, 'YT20241022095947f33114');

-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods`  (
  `id` bigint NOT NULL COMMENT '快递id',
  `send_user_id` bigint NOT NULL COMMENT '发件人',
  `get_user_id` bigint NOT NULL COMMENT '收件人',
  `express_code` varchar(24) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '快递码',
  `name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '快递名称',
  `quality` int NOT NULL COMMENT '快递重量',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `express_code`(`express_code` ASC) USING BTREE,
  INDEX `send_user_id`(`send_user_id` ASC) USING BTREE,
  INDEX `get_user_id`(`get_user_id` ASC) USING BTREE,
  CONSTRAINT `goods_ibfk_1` FOREIGN KEY (`send_user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `goods_ibfk_2` FOREIGN KEY (`get_user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of goods
-- ----------------------------
INSERT INTO `goods` VALUES (1848543466089521153, 1848316858330193922, 1848523815259402241, 'YT202410220954413b5cce41', 'java开发手册', 1);
INSERT INTO `goods` VALUES (1848543555310755841, 1848316858330193922, 1848523815259402241, 'YT202410220955028c641f14', '高考一百天冲刺卷子', 1);
INSERT INTO `goods` VALUES (1848543604904206338, 1848316858330193922, 1848523815259402241, 'YT20241022095514a6640e96', 'gsl的秘密', 1);
INSERT INTO `goods` VALUES (1848543645941276674, 1848316858330193922, 1848523815259402241, 'YT20241022095524ea6ed7b3', 'Linux手册', 1);
INSERT INTO `goods` VALUES (1848544752499306498, 1848523815259402241, 1848316858330193922, 'YT20241022095947a0dbda6c', '犯罪指南', 1);

-- ----------------------------
-- Table structure for message
-- ----------------------------
DROP TABLE IF EXISTS `message`;
CREATE TABLE `message`  (
  `id` bigint NOT NULL COMMENT '消息id',
  `content` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL COMMENT '留言',
  `send_user_id` bigint NOT NULL COMMENT '留言者',
  `get_user_id` bigint NOT NULL COMMENT '给谁留言的',
  `mark` int NULL DEFAULT 1 COMMENT '0: 留言被查看 1: 留言暂未查看',
  `create_time` datetime NULL DEFAULT NULL COMMENT '发送时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '确认消息时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `message_ibfk_1`(`send_user_id` ASC) USING BTREE,
  INDEX `message_ibfk_2`(`get_user_id` ASC) USING BTREE,
  CONSTRAINT `message_ibfk_1` FOREIGN KEY (`send_user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `message_ibfk_2` FOREIGN KEY (`get_user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of message
-- ----------------------------
INSERT INTO `message` VALUES (1848314247455617026, '快递员一号你好，我是管理员', 1848310231438860290, 1848313214998306817, 1, '2024-10-21 18:43:51', '2024-10-21 18:43:51');
INSERT INTO `message` VALUES (1848318276436901890, '快递员一号你好，我是grs，可以找你帮我发快递吗？', 1848316858330193922, 1848313214998306817, 1, '2024-10-21 18:59:52', '2024-10-21 18:59:52');
INSERT INTO `message` VALUES (1848320484234637313, '官榕胜同学你好', 1848310231438860290, 1848316858330193922, 0, '2024-10-21 19:08:38', '2024-10-21 19:08:38');
INSERT INTO `message` VALUES (1848891911719559169, '官榕胜同学，请签收一下你的快递，谢谢了', 1848313214998306817, 1848316858330193922, 1, '2024-10-23 08:59:17', '2024-10-23 08:59:17');

-- ----------------------------
-- Table structure for records
-- ----------------------------
DROP TABLE IF EXISTS `records`;
CREATE TABLE `records`  (
  `id` bigint NOT NULL COMMENT '快递记录id',
  `send_user_id` bigint NOT NULL COMMENT '寄件人',
  `get_user_id` bigint NOT NULL COMMENT '收件人',
  `addressee_id` bigint NULL DEFAULT NULL COMMENT '签收者',
  `express_id` bigint NOT NULL COMMENT '快递员',
  `address_id` bigint NOT NULL COMMENT '送到哪里',
  `goods_id` bigint NOT NULL COMMENT '物品信息',
  `mark` int NULL DEFAULT 0 COMMENT '0: 未签收 1: 已签收',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `send_user_id`(`send_user_id` ASC) USING BTREE,
  INDEX `get_user_id`(`get_user_id` ASC) USING BTREE,
  INDEX `addressee_id`(`addressee_id` ASC) USING BTREE,
  INDEX `goods_id`(`goods_id` ASC) USING BTREE,
  INDEX `express_id`(`express_id` ASC) USING BTREE,
  INDEX `address_id`(`address_id` ASC) USING BTREE,
  CONSTRAINT `records_ibfk_1` FOREIGN KEY (`send_user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `records_ibfk_2` FOREIGN KEY (`get_user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `records_ibfk_3` FOREIGN KEY (`addressee_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `records_ibfk_4` FOREIGN KEY (`goods_id`) REFERENCES `goods` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `records_ibfk_5` FOREIGN KEY (`express_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `records_ibfk_6` FOREIGN KEY (`address_id`) REFERENCES `address` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of records
-- ----------------------------
INSERT INTO `records` VALUES (1848543466089521154, 1848316858330193922, 1848523815259402241, NULL, 1848313214998306817, 1848533495658516482, 1848543466089521153, 0, '2024-10-22 09:54:41');
INSERT INTO `records` VALUES (1848543555377864706, 1848316858330193922, 1848523815259402241, NULL, 1848313214998306817, 1848533495658516482, 1848543555310755841, 0, '2024-10-22 09:55:03');
INSERT INTO `records` VALUES (1848543604971315202, 1848316858330193922, 1848523815259402241, NULL, 1848313214998306817, 1848533495658516482, 1848543604904206338, 0, '2024-10-22 09:55:14');
INSERT INTO `records` VALUES (1848543646008385538, 1848316858330193922, 1848523815259402241, 1848316858330193922, 1848313214998306817, 1848533495658516482, 1848543645941276674, 1, '2024-10-22 09:55:24');
INSERT INTO `records` VALUES (1848544752541249537, 1848523815259402241, 1848316858330193922, 1848316858330193922, 1848313214998306817, 1848323292988100610, 1848544752499306498, 1, '2024-10-22 09:59:48');

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
  `id` bigint NOT NULL COMMENT '用户id',
  `user_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户名',
  `account` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户账号',
  `phone` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '手机号',
  `password` varchar(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '用户密码',
  `identity` varchar(18) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '身份证',
  `likes` int NULL DEFAULT 0 COMMENT '点赞次数',
  `mark` int NULL DEFAULT 0 COMMENT '用户标识: 0普通用户 1快递员 2管理员',
  `disabled` int NULL DEFAULT 0 COMMENT '禁用标志 0: 没有 1: 禁用',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `login_time` datetime NULL DEFAULT NULL COMMENT '最近一次登录时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '最近更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `user_name`(`user_name` ASC) USING BTREE,
  UNIQUE INDEX `account`(`account` ASC) USING BTREE,
  UNIQUE INDEX `phone`(`phone` ASC) USING BTREE,
  UNIQUE INDEX `identity`(`identity` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1848310231438860290, 'admin', 'admin', '18750117167', '21232f297a57a5a743894a0e4a801fc3', '350104200211271554', 0, 2, 0, '2024-10-21 18:27:54', '2024-11-01 16:27:11', '2024-10-21 18:32:23');
INSERT INTO `user` VALUES (1848313214998306817, 'emOne', 'emOne', '18750117166', '17f6fe1d6e8824aa95cd823a04a1735e', '350104200211271553', 2, 1, 0, '2024-10-21 18:39:45', '2024-10-23 08:51:35', '2024-10-21 18:39:45');
INSERT INTO `user` VALUES (1848316858330193922, 'grs', 'grs', '18750117160', 'a1ca50b49044afbeeed4b5e31dbece6c', '350104200211271550', 0, 0, 0, '2024-10-21 18:54:14', '2024-10-23 09:00:15', '2024-10-21 18:54:14');
INSERT INTO `user` VALUES (1848523815259402241, 'chj', 'chj', '18750117161', 'c4904bd9b0fe86a6809ba6cb57e1ad30', '350104200211271551', 0, 0, 0, '2024-10-22 08:36:36', '2024-10-22 09:58:47', '2024-10-22 08:36:36');
INSERT INTO `user` VALUES (1848544937652662274, 'emTwo', 'emTwo', '18750117162', '9d5c7143c7e105331d7aed75d17b59c3', '350104200211271559', 0, 1, 0, '2024-10-22 10:00:32', NULL, '2024-10-22 10:00:32');
INSERT INTO `user` VALUES (1849639443382857730, 'jhj', 'jhj', '18750334576', '20fc6e83c7e38bb5cb5260cb8a0cbda5', '350104200211261554', 0, 0, 0, '2024-10-25 10:29:43', NULL, '2024-10-25 10:29:43');
INSERT INTO `user` VALUES (1851869410121809921, '陈金三', 'cjh', '17829653387', '15b697eae54fd4ab7143c616df92334c', '350104200810311552', 0, 1, 0, '2024-10-31 14:10:48', NULL, '2024-10-31 14:10:48');
INSERT INTO `user` VALUES (1852266092133793794, 'TestUSER1', 'TestUSER1', '18750117777', '2188eb4e691ab2f44faa2f22d02a6c36', '350104200711271554', 0, 0, 1, '2024-11-01 16:27:04', NULL, '2024-11-01 16:27:04');

SET FOREIGN_KEY_CHECKS = 1;
