/*
 Navicat Premium Data Transfer

 Source Server         : local
 Source Server Type    : MySQL
 Source Server Version : 80041 (8.0.41)
 Source Host           : localhost:3306
 Source Schema         : a_business_help

 Target Server Type    : MySQL
 Target Server Version : 80041 (8.0.41)
 File Encoding         : 65001

 Date: 27/12/2025 17:18:06
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for banners
-- ----------------------------
DROP TABLE IF EXISTS `banners`;
CREATE TABLE `banners`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '轮播图标题',
  `image_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '轮播图图片URL',
  `link_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '点击跳转链接',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '描述信息',
  `sort_order` bigint NOT NULL DEFAULT 0 COMMENT '排序序号',
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态：0禁用，1启用',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of banners
-- ----------------------------
INSERT INTO `banners` VALUES (1, '1', '/back/file/20250916110937_f2a179bd.png', '', '', 0, 1, '2025-09-16 11:09:41', '2025-09-16 11:09:41');
INSERT INTO `banners` VALUES (2, '2', '/back/file/20250916111002_09ee01c2.png', '', '', 1, 1, '2025-09-16 11:10:03', '2025-09-16 11:11:24');

-- ----------------------------
-- Table structure for config_changes
-- ----------------------------
DROP TABLE IF EXISTS `config_changes`;
CREATE TABLE `config_changes`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '配置键',
  `old_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '旧值',
  `new_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '新值',
  `change_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '变更类型',
  `changed_by` bigint NOT NULL COMMENT '修改人ID',
  `changed_at` bigint NOT NULL COMMENT '修改时间戳',
  `extra` json NULL COMMENT '额外信息',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of config_changes
-- ----------------------------

-- ----------------------------
-- Table structure for order_messages
-- ----------------------------
DROP TABLE IF EXISTS `order_messages`;
CREATE TABLE `order_messages`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `order_id` bigint UNSIGNED NOT NULL,
  `order_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'purchase',
  `user_id` bigint UNSIGNED NOT NULL,
  `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `created_at` datetime(3) NULL DEFAULT NULL,
  `updated_at` datetime(3) NULL DEFAULT NULL,
  `images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_order_messages_order_id`(`order_id` ASC) USING BTREE,
  INDEX `idx_order_messages_user_id`(`user_id` ASC) USING BTREE,
  CONSTRAINT `fk_order_messages_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of order_messages
-- ----------------------------
INSERT INTO `order_messages` VALUES (1, 13, 'purchase', 8, '你好', '2025-09-13 14:04:51.529', '2025-09-13 14:04:51.529', NULL);
INSERT INTO `order_messages` VALUES (2, 6, 'sales', 8, '已完成', '2025-09-13 14:07:19.470', '2025-09-13 14:07:19.470', NULL);
INSERT INTO `order_messages` VALUES (3, 17, 'purchase', 7, '尽快确认', '2025-09-13 14:22:25.648', '2025-09-13 14:22:25.648', NULL);
INSERT INTO `order_messages` VALUES (4, 7, 'sales', 8, '了解', '2025-09-13 15:19:49.892', '2025-09-13 15:19:49.892', NULL);
INSERT INTO `order_messages` VALUES (5, 21, 'purchase', 1, '完成', '2025-09-13 16:48:34.984', '2025-09-13 16:48:34.984', NULL);
INSERT INTO `order_messages` VALUES (6, 7, 'purchase', 7, '凭证在此', '2025-09-16 12:31:32.666', '2025-09-16 12:31:32.666', '/back/file/20250916123132_da65b168.png');
INSERT INTO `order_messages` VALUES (7, 22, 'purchase', 7, '你好', '2025-09-16 12:36:53.652', '2025-09-16 12:36:53.652', '');
INSERT INTO `order_messages` VALUES (8, 22, 'purchase', 7, '阿斯顿', '2025-09-16 12:43:38.617', '2025-09-16 12:43:38.617', '/back/file/20250916124338_dededd0c.png');
INSERT INTO `order_messages` VALUES (9, 9, 'sales', 7, '阿萨', '2025-09-16 12:53:47.556', '2025-09-16 12:53:47.556', '/back/file/20250916125347_dededd0c.png');

-- ----------------------------
-- Table structure for primary_products
-- ----------------------------
DROP TABLE IF EXISTS `primary_products`;
CREATE TABLE `primary_products`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `category_id` bigint UNSIGNED NOT NULL COMMENT '分类ID',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
  `product_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品描述',
  `product_images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品图片URLs，逗号分割',
  `original_price` decimal(10, 2) NOT NULL COMMENT '原价',
  `current_price` decimal(10, 2) NOT NULL COMMENT '现价',
  `stock_quantity` bigint NOT NULL DEFAULT 0 COMMENT '库存数量',
  `sales_count` bigint NOT NULL DEFAULT 0 COMMENT '销量',
  `view_count` bigint NOT NULL DEFAULT 0 COMMENT '浏览量',
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态：0下架，1上架',
  `sort_order` bigint NOT NULL DEFAULT 0 COMMENT '排序序号',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_hot` tinyint NOT NULL DEFAULT 0 COMMENT '是否为热门商品：0否，1是',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_primary_products_category`(`category_id` ASC) USING BTREE,
  CONSTRAINT `fk_primary_products_category` FOREIGN KEY (`category_id`) REFERENCES `product_categories` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of primary_products
-- ----------------------------
INSERT INTO `primary_products` VALUES (1, 4, '酒水', '酒水酒水', '/back/file/20250902104133_a0ac0a17.jpeg,/back/file/20250902104136_e18fe0eb.jpeg', 999.00, 888.00, 9976, 29, 32, 1, 0, '2025-09-02 10:41:47', '2025-12-20 16:02:04', 1);
INSERT INTO `primary_products` VALUES (2, 3, '测试', '啊手动阀手动阀', '/back/file/20250916115526_fc06f62c.png', 99.00, 77.00, 72, 5, 4, 1, 0, '2025-09-16 11:55:34', '2025-12-20 15:30:16', 0);

-- ----------------------------
-- Table structure for product_categories
-- ----------------------------
DROP TABLE IF EXISTS `product_categories`;
CREATE TABLE `product_categories`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `category_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '分类名称',
  `category_icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分类图标URL',
  `sort_order` bigint NOT NULL DEFAULT 0 COMMENT '排序序号',
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态：0禁用，1启用',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of product_categories
-- ----------------------------
INSERT INTO `product_categories` VALUES (1, '学习培训', '/back/file/20250902091924_9b4298ba.png', 0, 1, '2025-09-02 09:19:27', '2025-09-02 10:47:09');
INSERT INTO `product_categories` VALUES (2, '美食', '/back/file/20250902092108_e056556d.png', 1, 1, '2025-09-02 09:21:20', '2025-09-02 09:21:20');
INSERT INTO `product_categories` VALUES (3, '酒店', '/back/file/20250902102539_639669b0.png', 0, 1, '2025-09-02 10:25:40', '2025-09-02 10:25:40');
INSERT INTO `product_categories` VALUES (4, '酒水饮料', '/back/file/20250902102604_883b4677.png', 3, 1, '2025-09-02 10:26:08', '2025-09-02 10:26:08');
INSERT INTO `product_categories` VALUES (5, 'yi', '/back/file/20250916105653_0b6dc315.png', 0, 1, '2025-09-16 10:57:00', '2025-09-16 10:57:00');
INSERT INTO `product_categories` VALUES (6, '二', '/back/file/20250916105705_0b6dc315.png', 0, 1, '2025-09-16 10:57:08', '2025-09-16 10:57:08');
INSERT INTO `product_categories` VALUES (7, '三', '/back/file/20250916105715_0b6dc315.png', 0, 1, '2025-09-16 10:57:15', '2025-09-16 10:57:15');
INSERT INTO `product_categories` VALUES (8, '四', '/back/file/20250916105722_0b6dc315.png', 0, 1, '2025-09-16 10:57:23', '2025-09-16 10:57:23');
INSERT INTO `product_categories` VALUES (9, '五', '/back/file/20250916105729_0b6dc315.png', 0, 1, '2025-09-16 10:57:30', '2025-09-16 10:57:30');

-- ----------------------------
-- Table structure for purchase_orders
-- ----------------------------
DROP TABLE IF EXISTS `purchase_orders`;
CREATE TABLE `purchase_orders`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单编号',
  `buyer_id` bigint UNSIGNED NOT NULL COMMENT '买家用户ID',
  `seller_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '卖家用户ID（二级商品交易时使用）',
  `product_id` bigint NOT NULL COMMENT '商品ID',
  `product_type` tinyint NOT NULL COMMENT '商品类型：1一级商品，2二级商品',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
  `product_images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品图片URLs，逗号分割',
  `unit_price` decimal(10, 2) NOT NULL COMMENT '单价',
  `quantity` bigint NOT NULL DEFAULT 1 COMMENT '数量',
  `total_amount` decimal(10, 2) NOT NULL COMMENT '总金额',
  `address_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '收货地址ID',
  `order_status` tinyint NOT NULL DEFAULT 0 COMMENT '订单状态：0待付款，1待确认，2已完成，3已取消',
  `confirm_time` timestamp NULL DEFAULT NULL COMMENT '确认时间',
  `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '备注',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `payment_proof_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `idx_purchase_orders_order_no`(`order_no` ASC) USING BTREE,
  INDEX `fk_purchase_orders_buyer`(`buyer_id` ASC) USING BTREE,
  INDEX `fk_purchase_orders_seller`(`seller_id` ASC) USING BTREE,
  INDEX `fk_purchase_orders_address`(`address_id` ASC) USING BTREE,
  CONSTRAINT `fk_purchase_orders_address` FOREIGN KEY (`address_id`) REFERENCES `user_addresses` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_purchase_orders_buyer` FOREIGN KEY (`buyer_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_purchase_orders_seller` FOREIGN KEY (`seller_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 34 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of purchase_orders
-- ----------------------------
INSERT INTO `purchase_orders` VALUES (1, 'PO17568750558', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 2, 1776.00, 1, 3, NULL, '', '2025-09-03 12:50:55', '2025-09-03 12:57:31', '');
INSERT INTO `purchase_orders` VALUES (2, 'PO17568755868', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 2, 1776.00, 1, 2, '2025-09-03 13:25:21', '完成了', '2025-09-03 12:59:46', '2025-09-03 13:25:21', '/back/file/20250903125954_d771c101.png');
INSERT INTO `purchase_orders` VALUES (3, 'PO17568780478', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 1, 2, '2025-09-03 13:41:10', '欧克', '2025-09-03 13:40:47', '2025-09-03 13:41:10', '/back/file/20250903134051_ea22e0d9.jpeg');
INSERT INTO `purchase_orders` VALUES (4, 'PO17568782318', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 1, 2, '2025-09-03 13:44:35', '欧克', '2025-09-03 13:43:51', '2025-09-03 13:44:35', '/back/file/20250903134356_d771c101.png');
INSERT INTO `purchase_orders` VALUES (5, 'PO17568784918', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 1, 2, '2025-09-03 13:48:41', '完成', '2025-09-03 13:48:11', '2025-09-03 13:48:41', '/back/file/20250903134815_d771c101.png');
INSERT INTO `purchase_orders` VALUES (6, 'PO17568801536', 6, 8, 1, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 899.00, 1, 899.00, 2, 3, NULL, '', '2025-09-03 14:15:53', '2025-09-03 17:12:32', '');
INSERT INTO `purchase_orders` VALUES (7, 'PO17568835147', 7, 8, 2, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 3, 2, '2025-09-03 15:43:47', '', '2025-09-03 15:11:54', '2025-09-03 15:43:47', '/back/file/20250903153218_ea22e0d9.jpeg');
INSERT INTO `purchase_orders` VALUES (8, 'PO17569507758', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 1, 3, NULL, '', '2025-09-04 09:52:55', '2025-09-04 09:53:11', '');
INSERT INTO `purchase_orders` VALUES (9, 'PO17569509006', 6, 8, 5, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 2, 3, NULL, '', '2025-09-04 09:55:00', '2025-09-04 09:55:18', '');
INSERT INTO `purchase_orders` VALUES (10, 'PO17569509266', 6, 8, 5, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 2, 3, NULL, '', '2025-09-04 09:55:26', '2025-09-04 10:27:58', '/back/file/20250904101417_7c6bf467.png');
INSERT INTO `purchase_orders` VALUES (11, 'PO17577382648', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 1, 3, NULL, '', '2025-09-13 12:37:44', '2025-09-13 13:15:00', '');
INSERT INTO `purchase_orders` VALUES (12, 'PO17577385698', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 1, 3, NULL, '', '2025-09-13 12:42:49', '2025-09-13 13:15:00', '');
INSERT INTO `purchase_orders` VALUES (13, 'PO17577389748', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 1, 2, '2025-09-13 12:52:02', '啊', '2025-09-13 12:49:34', '2025-09-13 12:52:02', '/back/file/20250913125113_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (14, 'PO17577391807', 7, 8, 6, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 2, '2025-09-13 12:56:18', '', '2025-09-13 12:53:00', '2025-09-13 12:56:18', '/back/file/20250913125535_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (15, 'PO17577392837', 7, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 3, 3, NULL, '', '2025-09-13 12:54:43', '2025-09-13 13:30:00', '');
INSERT INTO `purchase_orders` VALUES (16, 'PO17577394497', 7, 8, 5, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 1, NULL, '', '2025-09-13 12:57:29', '2025-09-13 12:57:34', '/back/file/20250913125733_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (17, 'PO17577445297', 7, 8, 7, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 1, NULL, '', '2025-09-13 14:22:09', '2025-09-13 14:22:15', '/back/file/20250913142213_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (18, 'PO17577518998', 8, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 5, 4440.00, 1, 1, NULL, '', '2025-09-13 16:24:59', '2025-09-13 16:25:03', '/back/file/20250913162502_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (19, 'PO17577522668', 8, 7, 8, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 870.00, 1, 870.00, 1, 2, '2025-09-13 16:31:35', '', '2025-09-13 16:31:06', '2025-09-13 16:31:35', '/back/file/20250913163110_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (20, 'PO17577524237', 7, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 3, 2, '2025-09-13 16:34:03', '啊', '2025-09-13 16:33:43', '2025-09-13 16:34:03', '/back/file/20250913163347_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (21, 'PO17577524978', 8, 7, 9, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 1, 2, '2025-09-13 16:35:27', '', '2025-09-13 16:34:57', '2025-09-13 16:35:27', '/back/file/20250913163500_3657ddb6.jpg');
INSERT INTO `purchase_orders` VALUES (22, 'PO17579957867', 7, NULL, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 1, 77.00, 3, 2, '2025-09-16 12:10:09', '完成', '2025-09-16 12:09:46', '2025-09-16 12:10:09', '/back/file/20250916120952_dededd0c.png');
INSERT INTO `purchase_orders` VALUES (23, 'PO17586830156', 6, 7, 10, 2, '测试', '/back/file/20250916115526_fc06f62c.png', 68.00, 1, 68.00, 2, 2, '2025-09-24 11:05:08', '', '2025-09-24 11:03:35', '2025-09-24 11:05:08', '/back/file/20250924110357_ea22e0d9.jpeg');
INSERT INTO `purchase_orders` VALUES (24, 'PO17586847026', 6, 8, 4, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 2, 1, NULL, '', '2025-09-24 11:31:42', '2025-09-24 11:32:21', '/back/file/20250924113219_0b6dc315.png');
INSERT INTO `purchase_orders` VALUES (25, 'PO17586847646', 6, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 10, 8880.00, 2, 2, '2025-09-24 11:33:59', '而无法', '2025-09-24 11:32:44', '2025-09-24 11:33:59', '/back/file/20250924113247_883b4677.png');
INSERT INTO `purchase_orders` VALUES (26, 'PO17586849757', 7, 6, 11, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 2, '2025-09-24 11:45:30', '', '2025-09-24 11:36:15', '2025-09-24 11:45:30', '/back/file/20250924113618_883b4677.png');
INSERT INTO `purchase_orders` VALUES (27, 'PO17662156171', 1, NULL, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 1, 77.00, 5, 2, '2025-12-20 15:29:00', 'wc1', '2025-12-20 15:26:57', '2025-12-20 15:29:00', '/back/file/20251220152707_b89ec398.png');
INSERT INTO `purchase_orders` VALUES (28, 'PO17662157691', 1, NULL, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 1, 77.00, 5, 2, '2025-12-20 15:30:09', '123', '2025-12-20 15:29:29', '2025-12-20 15:30:09', '/back/file/20251220152938_71cb232a.png');
INSERT INTO `purchase_orders` VALUES (29, 'PO17662157911', 1, NULL, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 1, 77.00, 5, 2, '2025-12-20 15:30:06', ' 123', '2025-12-20 15:29:51', '2025-12-20 15:30:06', '/back/file/20251220152955_2e30c931.png');
INSERT INTO `purchase_orders` VALUES (30, 'PO17662158151', 1, NULL, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 1, 77.00, 5, 1, NULL, '', '2025-12-20 15:30:15', '2025-12-20 15:30:20', '/back/file/20251220153019_2e30c931.png');
INSERT INTO `purchase_orders` VALUES (31, 'PO17662160932', 2, 1, 14, 2, '测试', '/back/file/20250916115526_fc06f62c.png', 68.00, 1, 68.00, 6, 2, '2025-12-20 16:01:52', '', '2025-12-20 15:34:53', '2025-12-20 16:01:52', '/back/file/20251220153458_02f6f844.png');
INSERT INTO `purchase_orders` VALUES (32, 'PO17662177231', 1, NULL, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 5, 0, NULL, '', '2025-12-20 16:02:03', '2025-12-20 16:02:03', '');
INSERT INTO `purchase_orders` VALUES (33, 'PO17662179888', 8, 1, 13, 2, '测试', '/back/file/20250916115526_fc06f62c.png', 68.00, 1, 68.00, 4, 0, NULL, '', '2025-12-20 16:06:28', '2025-12-20 16:06:28', '');

-- ----------------------------
-- Table structure for sales_orders
-- ----------------------------
DROP TABLE IF EXISTS `sales_orders`;
CREATE TABLE `sales_orders`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `order_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单编号',
  `seller_id` bigint UNSIGNED NOT NULL COMMENT '卖家用户ID',
  `buyer_id` bigint UNSIGNED NOT NULL COMMENT '买家用户ID',
  `secondary_product_id` bigint UNSIGNED NOT NULL COMMENT '二级商品ID',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
  `product_images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品图片URLs，逗号分割',
  `selling_price` decimal(10, 2) NOT NULL COMMENT '出售价格',
  `quantity` bigint NOT NULL DEFAULT 1 COMMENT '数量',
  `total_amount` decimal(10, 2) NOT NULL COMMENT '总金额',
  `address_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT '收货地址ID',
  `order_status` tinyint NOT NULL DEFAULT 0 COMMENT '订单状态：0待付款，1待发货，2确认完成，3已取消',
  `complete_time` timestamp NULL DEFAULT NULL COMMENT '完成时间',
  `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '备注',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `payment_proof_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `purchase_order_id` bigint UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `idx_sales_orders_order_no`(`order_no` ASC) USING BTREE,
  INDEX `fk_sales_orders_secondary_product`(`secondary_product_id` ASC) USING BTREE,
  INDEX `fk_sales_orders_address`(`address_id` ASC) USING BTREE,
  INDEX `fk_sales_orders_seller`(`seller_id` ASC) USING BTREE,
  INDEX `fk_sales_orders_buyer`(`buyer_id` ASC) USING BTREE,
  INDEX `fk_sales_orders_purchase_order`(`purchase_order_id` ASC) USING BTREE,
  CONSTRAINT `fk_sales_orders_address` FOREIGN KEY (`address_id`) REFERENCES `user_addresses` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_sales_orders_buyer` FOREIGN KEY (`buyer_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_sales_orders_purchase_order` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_sales_orders_secondary_product` FOREIGN KEY (`secondary_product_id`) REFERENCES `secondary_products` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_sales_orders_seller` FOREIGN KEY (`seller_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of sales_orders
-- ----------------------------
INSERT INTO `sales_orders` VALUES (1, 'SO17568801538', 8, 6, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 899.00, 1, 899.00, 2, 3, NULL, '', '2025-09-03 14:15:53', '2025-12-20 16:04:53', '', 6);
INSERT INTO `sales_orders` VALUES (2, 'SO17568835148', 8, 7, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 1, 888.00, 3, 2, '2025-09-03 15:43:47', '', '2025-09-03 15:11:54', '2025-09-03 15:43:47', '/back/file/20250903153218_ea22e0d9.jpeg', 7);
INSERT INTO `sales_orders` VALUES (3, 'SO17569509008', 8, 6, 5, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 2, 3, NULL, '', '2025-09-04 09:55:00', '2025-12-20 16:04:53', '', 9);
INSERT INTO `sales_orders` VALUES (4, 'SO17569509268', 8, 6, 5, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 2, 3, NULL, '不完整', '2025-09-04 09:55:26', '2025-12-20 16:04:53', '/back/file/20250904101417_7c6bf467.png', 10);
INSERT INTO `sales_orders` VALUES (5, 'SO17577391808', 8, 7, 6, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 2, '2025-09-13 12:56:18', '', '2025-09-13 12:53:00', '2025-09-13 12:56:18', '/back/file/20250913125535_3657ddb6.jpg', 14);
INSERT INTO `sales_orders` VALUES (6, 'SO17577394498', 8, 7, 5, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 2, '2025-09-13 12:57:54', '完成', '2025-09-13 12:57:29', '2025-09-13 12:57:54', '/back/file/20250913125733_3657ddb6.jpg', 16);
INSERT INTO `sales_orders` VALUES (7, 'SO17577445298', 8, 7, 7, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 2, '2025-09-13 16:26:39', '完成', '2025-09-13 14:22:09', '2025-09-13 16:26:39', '/back/file/20250913142213_3657ddb6.jpg', 17);
INSERT INTO `sales_orders` VALUES (8, 'SO17577522667', 7, 8, 8, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 870.00, 1, 870.00, 1, 2, '2025-09-13 16:31:35', '', '2025-09-13 16:31:06', '2025-09-13 16:31:35', '/back/file/20250913163110_3657ddb6.jpg', 19);
INSERT INTO `sales_orders` VALUES (9, 'SO17577524977', 7, 8, 9, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 1, 2, '2025-09-13 16:35:27', '', '2025-09-13 16:34:57', '2025-09-13 16:35:27', '/back/file/20250913163500_3657ddb6.jpg', 21);
INSERT INTO `sales_orders` VALUES (10, 'SO17586830157', 7, 6, 10, '测试', '/back/file/20250916115526_fc06f62c.png', 68.00, 1, 68.00, 2, 2, '2025-09-24 11:05:08', '', '2025-09-24 11:03:35', '2025-09-24 11:05:08', '/back/file/20250924110357_ea22e0d9.jpeg', 23);
INSERT INTO `sales_orders` VALUES (11, 'SO17586847028', 8, 6, 4, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 2, 1, NULL, '', '2025-09-24 11:31:42', '2025-09-24 11:32:21', '/back/file/20250924113219_0b6dc315.png', 24);
INSERT INTO `sales_orders` VALUES (12, 'SO17586849756', 6, 7, 11, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 1, 879.00, 3, 2, '2025-09-24 11:45:30', '', '2025-09-24 11:36:15', '2025-09-24 11:45:30', '/back/file/20250924113618_883b4677.png', 26);
INSERT INTO `sales_orders` VALUES (13, 'SO17662160931', 1, 2, 14, '测试', '/back/file/20250916115526_fc06f62c.png', 68.00, 1, 68.00, 6, 2, '2025-12-20 16:01:52', '', '2025-12-20 15:34:53', '2025-12-20 16:01:52', '/back/file/20251220153458_02f6f844.png', 31);
INSERT INTO `sales_orders` VALUES (14, 'SO17662179881', 1, 8, 13, '测试', '/back/file/20250916115526_fc06f62c.png', 68.00, 1, 68.00, 4, 0, NULL, '', '2025-12-20 16:06:28', '2025-12-20 16:06:28', '', 33);

-- ----------------------------
-- Table structure for score_records
-- ----------------------------
DROP TABLE IF EXISTS `score_records`;
CREATE TABLE `score_records`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL COMMENT '用户编号',
  `change_number` bigint NOT NULL COMMENT '变化数量',
  `note` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '说明',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_score_records_user`(`user_id` ASC) USING BTREE,
  CONSTRAINT `fk_score_records_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of score_records
-- ----------------------------
INSERT INTO `score_records` VALUES (1, 4, 5, 'ig', '2025-09-02 09:00:33', '2025-09-02 09:00:33');
INSERT INTO `score_records` VALUES (3, 5, 5, '赠送', '2025-09-03 16:32:08', '2025-09-03 16:32:08');
INSERT INTO `score_records` VALUES (4, 8, 3000, '系统充值', '2025-09-03 16:55:00', '2025-09-03 16:55:00');
INSERT INTO `score_records` VALUES (5, 8, -500, '扣除', '2025-09-03 16:55:14', '2025-09-03 16:55:14');
INSERT INTO `score_records` VALUES (6, 8, 9, '系统策略', '2025-09-13 12:56:18', '2025-09-13 12:56:18');
INSERT INTO `score_records` VALUES (7, 7, 9, '系统策略', '2025-09-13 16:31:34', '2025-09-13 16:31:34');
INSERT INTO `score_records` VALUES (8, 7, 9, '系统策略', '2025-09-13 16:35:27', '2025-09-13 16:35:27');
INSERT INTO `score_records` VALUES (9, 7, 9, '系统策略', '2025-09-24 11:05:07', '2025-09-24 11:05:07');
INSERT INTO `score_records` VALUES (10, 6, 9, '系统策略', '2025-09-24 11:38:01', '2025-09-24 11:38:01');
INSERT INTO `score_records` VALUES (11, 6, 9, '系统策略', '2025-09-24 11:43:59', '2025-09-24 11:43:59');
INSERT INTO `score_records` VALUES (12, 6, 9, '系统策略', '2025-09-24 11:45:30', '2025-09-24 11:45:30');
INSERT INTO `score_records` VALUES (13, 1, 9, '系统策略', '2025-12-20 16:01:51', '2025-12-20 16:01:51');

-- ----------------------------
-- Table structure for secondary_products
-- ----------------------------
DROP TABLE IF EXISTS `secondary_products`;
CREATE TABLE `secondary_products`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `seller_id` bigint UNSIGNED NOT NULL COMMENT '卖家用户ID',
  `original_product_id` bigint NULL DEFAULT NULL COMMENT '原始商品ID（一级商品ID或二级商品ID）',
  `original_product_type` tinyint NOT NULL COMMENT '原始商品类型：1一级商品，2二级商品',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
  `product_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品描述',
  `product_images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品图片URLs，JSON格式存储',
  `cost_price` decimal(10, 2) NOT NULL COMMENT '成本价（用户购买时的价格）',
  `selling_price` decimal(10, 2) NOT NULL COMMENT '出售价格',
  `quantity` bigint NOT NULL DEFAULT 1 COMMENT '出售数量',
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态：0下架，1上架，2已售出',
  `view_count` bigint NOT NULL DEFAULT 0 COMMENT '浏览量',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `category_id` bigint UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品分类ID',
  `product_condition` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
  `user_warehouse_id` bigint UNSIGNED NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_secondary_products_seller`(`seller_id` ASC) USING BTREE,
  INDEX `fk_secondary_products_category`(`category_id` ASC) USING BTREE,
  INDEX `fk_secondary_products_user_warehouse`(`user_warehouse_id` ASC) USING BTREE,
  CONSTRAINT `fk_secondary_products_category` FOREIGN KEY (`category_id`) REFERENCES `product_categories` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_secondary_products_seller` FOREIGN KEY (`seller_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
  CONSTRAINT `fk_secondary_products_user_warehouse` FOREIGN KEY (`user_warehouse_id`) REFERENCES `user_warehouse` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of secondary_products
-- ----------------------------
INSERT INTO `secondary_products` VALUES (1, 8, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 899.00, 1, 0, 10, '2025-09-03 14:02:19', '2025-09-04 09:41:59', 1, '九成新', 3);
INSERT INTO `secondary_products` VALUES (2, 8, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 888.00, 0, 1, 11, '2025-09-03 15:09:40', '2025-09-10 13:33:29', 1, '九成新', 2);
INSERT INTO `secondary_products` VALUES (3, 8, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 976.80, 2, 0, 1, '2025-09-04 09:43:30', '2025-09-04 09:51:46', 1, '九成新', 1);
INSERT INTO `secondary_products` VALUES (4, 8, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 1, 17, '2025-09-04 09:53:50', '2025-09-24 11:31:43', 1, '九成新', 3);
INSERT INTO `secondary_products` VALUES (5, 8, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 1, 12, '2025-09-04 09:53:53', '2025-09-13 12:57:30', 1, '九成新', 1);
INSERT INTO `secondary_products` VALUES (6, 8, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 1, 6, '2025-09-13 12:52:30', '2025-09-13 12:57:23', 1, '九成新', 1);
INSERT INTO `secondary_products` VALUES (7, 8, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 1, 5, '2025-09-13 14:18:51', '2025-09-13 15:23:16', 1, '九成新', 4);
INSERT INTO `secondary_products` VALUES (8, 7, 7, 2, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 870.00, 0, 1, 4, '2025-09-13 16:28:41', '2025-09-13 16:31:06', 1, '九成新', 5);
INSERT INTO `secondary_products` VALUES (9, 7, 1, 1, '酒水', '酒水 - 来自个人仓库123', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 1, 3, '2025-09-13 16:34:24', '2025-09-13 16:34:58', 1, '九成新', 6);
INSERT INTO `secondary_products` VALUES (10, 7, 2, 1, '测试', '测试 - 来自个人仓库', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 0, 1, 4, '2025-09-16 12:10:21', '2025-09-24 11:03:36', 3, '九成新', 8);
INSERT INTO `secondary_products` VALUES (11, 6, 1, 1, '酒水', '酒水 - 来自个人仓库', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 1, 4, '2025-09-24 11:35:19', '2025-09-24 11:36:15', 4, '九成新', 9);
INSERT INTO `secondary_products` VALUES (12, 1, 2, 1, '测试', '测试 - 来自个人仓库', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 1, 1, 1, '2025-12-20 15:30:37', '2025-12-20 16:08:39', 3, '九成新', 11);
INSERT INTO `secondary_products` VALUES (13, 1, 2, 1, '测试', '测试 - 来自个人仓库', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 0, 1, 3, '2025-12-20 15:30:38', '2025-12-20 16:06:29', 3, '九成新', 13);
INSERT INTO `secondary_products` VALUES (14, 1, 2, 1, '测试', '测试 - 来自个人仓库', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 0, 1, 3, '2025-12-20 15:30:40', '2025-12-20 15:34:53', 3, '九成新', 12);

-- ----------------------------
-- Table structure for system_configs
-- ----------------------------
DROP TABLE IF EXISTS `system_configs`;
CREATE TABLE `system_configs`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '配置键',
  `config_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '配置值',
  `config_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '配置名称',
  `config_description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '配置描述',
  `config_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'string' COMMENT '配置类型：string、number、boolean、json',
  `is_system` tinyint NOT NULL DEFAULT 0 COMMENT '是否系统配置：0否，1是',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `idx_system_configs_config_key`(`config_key` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of system_configs
-- ----------------------------
INSERT INTO `system_configs` VALUES (1, 'warehouse_price_rate', '-9', '入库价格增值(负数为减少，正数为增加)', '商品进入用户仓库时的价格增值', 'number', 1, '2025-09-02 08:16:52', '2025-09-10 12:28:33');
INSERT INTO `system_configs` VALUES (6, 'order_over_time', '25', '订单超时时间', '订单超时时间(分钟)', 'number', 1, '2025-09-03 15:50:15', '2025-09-04 08:59:19');
INSERT INTO `system_configs` VALUES (7, 'phone', '12345678913', '客服电话', '', 'string', 1, '2025-09-03 15:53:02', '2025-09-04 08:58:54');
INSERT INTO `system_configs` VALUES (8, 'limit_days', '0', '买家限制天数(0 为不限制)', '限制天数(0 为不限制)', 'string', 1, '2025-09-04 08:52:16', '2025-12-20 16:08:15');

-- ----------------------------
-- Table structure for user_addresses
-- ----------------------------
DROP TABLE IF EXISTS `user_addresses`;
CREATE TABLE `user_addresses`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL COMMENT '用户ID',
  `consignee_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '收件人姓名',
  `consignee_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '收件人电话',
  `province` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '省份',
  `city` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '城市',
  `district` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '区县',
  `detail_address` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '详细地址',
  `postal_code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '邮政编码',
  `is_default` tinyint NOT NULL DEFAULT 0 COMMENT '是否默认地址：0否，1是',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_user_addresses_user`(`user_id` ASC) USING BTREE,
  CONSTRAINT `fk_user_addresses_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user_addresses
-- ----------------------------
INSERT INTO `user_addresses` VALUES (1, 8, '牛马牛马', '18369004078', '北京市', '北京市', '东城区', '阿斯顿撒旦撒大苏打', '', 0, '2025-09-03 11:13:51', '2025-09-13 20:48:10');
INSERT INTO `user_addresses` VALUES (2, 6, '牛阿斯顿', '18661900405', '北京市', '北京市', '东城区', 'sadsadsad', '', 1, '2025-09-03 14:15:48', '2025-09-03 14:15:48');
INSERT INTO `user_addresses` VALUES (3, 7, 'sad', '18361900405', '北京市', '北京市', '东城区', 'sadasd', '', 1, '2025-09-03 15:11:49', '2025-09-03 15:11:49');
INSERT INTO `user_addresses` VALUES (4, 8, '周天周天', '18961900403', '北京市', '市辖区', '朝阳区', '阿斯顿撒旦撒大苏打', '', 1, '2025-09-13 20:48:10', '2025-09-13 20:48:10');
INSERT INTO `user_addresses` VALUES (5, 1, '乱说的', '18361940401', '北京市', '市辖区', '东城区', 'asd', 'asdasd', 1, '2025-12-20 15:26:53', '2025-12-20 15:26:53');
INSERT INTO `user_addresses` VALUES (6, 2, 'wesr', '18361900405', '北京市', '市辖区', '东城区', 'sadf', 'asd', 1, '2025-12-20 15:34:50', '2025-12-20 15:34:50');

-- ----------------------------
-- Table structure for user_warehouse
-- ----------------------------
DROP TABLE IF EXISTS `user_warehouse`;
CREATE TABLE `user_warehouse`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` bigint UNSIGNED NOT NULL COMMENT '用户ID',
  `product_id` bigint NOT NULL COMMENT '商品ID',
  `product_type` tinyint NOT NULL COMMENT '商品类型：1一级商品，2二级商品',
  `product_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
  `product_images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '商品图片URLs，JSON格式存储',
  `purchase_price` decimal(10, 2) NOT NULL COMMENT '购买价格',
  `warehouse_price` decimal(10, 2) NOT NULL COMMENT '入库价格（根据系统常量增值后）',
  `quantity` bigint NOT NULL DEFAULT 1 COMMENT '数量',
  `source_order_id` bigint NULL DEFAULT NULL COMMENT '来源订单ID',
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态：0已出售，1库存中',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `fk_user_warehouse_user`(`user_id` ASC) USING BTREE,
  CONSTRAINT `fk_user_warehouse_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user_warehouse
-- ----------------------------
INSERT INTO `user_warehouse` VALUES (1, 8, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 1, 2, 1, '2025-09-03 13:25:20', '2025-09-13 12:52:31');
INSERT INTO `user_warehouse` VALUES (2, 8, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 888.00, 0, 4, 0, '2025-09-03 13:44:35', '2025-09-03 15:09:40');
INSERT INTO `user_warehouse` VALUES (3, 8, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 3, 5, 1, '2025-09-03 13:48:40', '2025-09-04 09:53:50');
INSERT INTO `user_warehouse` VALUES (4, 8, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 13, 0, '2025-09-13 12:52:02', '2025-09-13 14:18:52');
INSERT INTO `user_warehouse` VALUES (5, 7, 7, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 870.00, 0, 17, 0, '2025-09-13 16:26:38', '2025-09-13 16:28:42');
INSERT INTO `user_warehouse` VALUES (6, 7, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 0, 20, 0, '2025-09-13 16:34:03', '2025-09-13 16:34:25');
INSERT INTO `user_warehouse` VALUES (7, 8, 9, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 870.00, 1, 21, 1, '2025-09-13 16:35:27', '2025-09-13 16:35:27');
INSERT INTO `user_warehouse` VALUES (8, 7, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 0, 22, 0, '2025-09-16 12:10:09', '2025-09-16 12:10:21');
INSERT INTO `user_warehouse` VALUES (9, 6, 1, 1, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 888.00, 879.00, 9, 25, 1, '2025-09-24 11:33:58', '2025-09-24 11:35:19');
INSERT INTO `user_warehouse` VALUES (10, 7, 11, 2, '酒水', '/back/file/20250902104133_a0ac0a17.jpeg', 879.00, 870.00, 1, 26, 1, '2025-09-24 11:45:30', '2025-09-24 11:45:30');
INSERT INTO `user_warehouse` VALUES (11, 1, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 0, 27, 0, '2025-12-20 15:29:00', '2025-12-20 15:30:37');
INSERT INTO `user_warehouse` VALUES (12, 1, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 0, 29, 0, '2025-12-20 15:30:05', '2025-12-20 15:30:40');
INSERT INTO `user_warehouse` VALUES (13, 1, 2, 1, '测试', '/back/file/20250916115526_fc06f62c.png', 77.00, 68.00, 0, 28, 0, '2025-12-20 15:30:08', '2025-12-20 15:30:39');
INSERT INTO `user_warehouse` VALUES (14, 2, 14, 2, '测试', '/back/file/20250916115526_fc06f62c.png', 68.00, 59.00, 1, 31, 1, '2025-12-20 16:01:51', '2025-12-20 16:01:51');

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `system_role` tinyint NOT NULL DEFAULT 2 COMMENT '系统角色：0管理员，1代理商，2普通用户',
  `customer_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `real_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `current_points` bigint NOT NULL DEFAULT 0 COMMENT '当前积分',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `company_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `personal_intro` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL,
  `identity_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `referrer_identity_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `business_license_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `id_card_front_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `id_card_back_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `main_payment_qr_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `sub_payment_qr_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `status` tinyint NOT NULL DEFAULT 1 COMMENT '状态：0禁用，1启用',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `expiry_date` timestamp NULL DEFAULT NULL COMMENT '过期时间，null表示永不过期',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `idx_users_phone`(`phone` ASC) USING BTREE,
  UNIQUE INDEX `idx_users_identity_code`(`identity_code` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (1, '13800138000', 0, '系统管理员', 'Administrator', 9, '/back/file/20250902112107_639669b0.png', '', '', 'A00000001', '', '', '', '', '/back/file/20250903115327_af655669.jpeg', '/back/file/20250903115330_ea22e0d9.jpeg', 'e10adc3949ba59abbe56e057f20f883e', 1, '2025-09-02 08:16:52', '2025-12-20 16:01:52', NULL);
INSERT INTO `users` VALUES (2, '13800138001', 1, '测试代理商', 'Test Agent', 0, '', '', '', 'T00000002', '', '', '', '', '', '', 'e10adc3949ba59abbe56e057f20f883e', 1, '2025-09-02 08:16:52', '2025-09-13 16:51:06', NULL);
INSERT INTO `users` VALUES (3, '13800138002', 2, '测试用户1', 'Test User 1', 0, '', '', '', 'U00000003', 'T00000002', '', '', '', '', '', '6ad14ba9986e3615423dfca256d04e3f', 1, '2025-09-02 08:16:53', '2025-09-02 08:16:53', NULL);
INSERT INTO `users` VALUES (4, '13800138003', 2, '测试用户2', 'Test User 2', 5, '', '', '', 'U00000004', 'T00000002', '', '', '', '', '', '6ad14ba9986e3615423dfca256d04e3f', 1, '2025-09-02 08:16:53', '2025-09-02 09:00:34', NULL);
INSERT INTO `users` VALUES (5, '18361900404', 2, '李白', '李白', 5, '', '里吧科技', '', '', '', '', '', '', '', '', 'e10adc3949ba59abbe56e057f20f883e', 1, '2025-09-02 12:25:42', '2025-09-03 16:32:09', NULL);
INSERT INTO `users` VALUES (6, '18361900401', 2, '咯i', '年少的', 27, '', '阿三的', '', 'Ud853ac93', '', '', '', '', '', '', 'e10adc3949ba59abbe56e057f20f883e', 1, '2025-09-02 12:25:42', '2025-09-24 11:45:30', NULL);
INSERT INTO `users` VALUES (7, '18961900405', 1, '牛马', '牛马', 27, '', '阿三的', '', 'U00000007', 'T00000002', '/back/file/20250902150542_3a4a5b13.png', '/back/file/20250902150503_da9e6bd8.jpg', '/back/file/20250902150539_a082ce87.png', '', '', 'e10adc3949ba59abbe56e057f20f883e', 1, '2025-09-02 15:06:29', '2025-10-23 17:46:04', NULL);
INSERT INTO `users` VALUES (8, '13225208566', 2, '牛马', '张三', 2509, '/back/file/20250916114909_dededd0c.png', '阿三科技', '', 'U7f27a121', 'T00000002', '', '/back/file/20250903085714_da9e6bd8.jpg', '', '', '', 'e10adc3949ba59abbe56e057f20f883e', 1, '2025-09-03 08:57:43', '2025-12-20 16:06:15', '2025-09-30 00:00:00');

SET FOREIGN_KEY_CHECKS = 1;
