/*
 Navicat Premium Dump SQL

 Source Server         : local-mysql8
 Source Server Type    : MySQL
 Source Server Version : 80039 (8.0.39)
 Source Host           : localhost:3306
 Source Schema         : order

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

 Date: 24/05/2025 10:52:50
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for comsumer
-- ----------------------------
DROP TABLE IF EXISTS `comsumer`;
CREATE TABLE `comsumer` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '用户名称',
  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '收货地址',
  `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '联系方式',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of comsumer
-- ----------------------------
BEGIN;
INSERT INTO `comsumer` (`id`, `name`, `address`, `phone`) VALUES (1, '张三', '广东省惠州市', '13123456782');
INSERT INTO `comsumer` (`id`, `name`, `address`, `phone`) VALUES (2, '李四', '广东省深圳市', '18898765431');
INSERT INTO `comsumer` (`id`, `name`, `address`, `phone`) VALUES (3, '王五', '江苏', '15912345678');
INSERT INTO `comsumer` (`id`, `name`, `address`, `phone`) VALUES (5, '刘六', '江苏', '17923456789');
COMMIT;

-- ----------------------------
-- Table structure for good
-- ----------------------------
DROP TABLE IF EXISTS `good`;
CREATE TABLE `good` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '商品ID',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
  `price` double(7,2) DEFAULT NULL COMMENT '商品价格',
  `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '商品类型',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of good
-- ----------------------------
BEGIN;
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (1, 'iphone16', 8800.00, '手机');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (2, '华为mate70', 7000.00, '手机');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (3, '小米15', 5800.00, '手机');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (4, '微波炉', 900.00, '电器');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (5, '加湿器', 650.00, '电器');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (6, '小夜灯', 67.00, '电器');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (7, '打火机', 2.00, '日常用品');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (8, '毛巾', 10.00, '日常用品');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (9, '水杯', 30.00, '日常用品');
INSERT INTO `good` (`id`, `name`, `price`, `type`) VALUES (10, '鼠标', 123.00, '日常用品');
COMMIT;

-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '订单ID',
  `good_id` int NOT NULL COMMENT '商品ID',
  `num` int NOT NULL COMMENT '购买数量',
  `comsumer_id` int NOT NULL COMMENT '购买客户ID',
  `total_price` double(7,2) DEFAULT NULL COMMENT '总价格',
  `status` int NOT NULL DEFAULT '0' COMMENT '是否完成',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '订单时间',
  PRIMARY KEY (`id`,`good_id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Records of order
-- ----------------------------
BEGIN;
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (1, 8, 2, 1, 20.00, 0, '2025-05-06 17:45:28');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (2, 9, 1, 1, 30.00, 0, '2025-05-06 17:45:46');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (3, 1, 1, 2, 8800.00, 1, '2025-05-06 17:45:57');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (4, 2, 1, 3, 7000.00, 0, '2025-05-06 17:45:59');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (5, 3, 1, 4, 5800.00, 1, '2025-05-06 17:46:04');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (6, 3, 1, 5, 5700.00, 0, '2025-05-05 17:47:36');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (7, 3, 2, 5, 10600.00, 1, '2025-05-06 17:46:16');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (8, 1, 1, 1, 8700.00, 1, '2025-05-04 17:47:31');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (9, 4, 1, 5, 900.00, 0, '2025-05-06 17:46:29');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (10, 4, 2, 2, 1900.00, 1, '2025-05-03 17:47:16');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (11, 5, 1, 2, 650.00, 1, '2025-05-06 17:46:49');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (12, 6, 4, 3, 268.00, 1, '2025-05-06 17:47:01');
INSERT INTO `order` (`id`, `good_id`, `num`, `comsumer_id`, `total_price`, `status`, `create_time`) VALUES (13, 7, 2, 1, 4.00, 1, '2025-05-06 17:47:05');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
