/*
 Navicat Premium Dump SQL

 Source Server         : SunnyFarm
 Source Server Type    : MySQL
 Source Server Version : 80035 (8.0.35)
 Source Host           : 119.91.236.167:3306
 Source Schema         : sunnyfarm

 Target Server Type    : MySQL
 Target Server Version : 80035 (8.0.35)
 File Encoding         : 65001

 Date: 25/09/2025 05:47:46
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for admins
-- ----------------------------
DROP TABLE IF EXISTS `admins`;
CREATE TABLE `admins` (
                          `id` bigint NOT NULL AUTO_INCREMENT COMMENT '管理员ID',
                          `username` varchar(50) NOT NULL COMMENT '用户名',
                          `password` varchar(128) NOT NULL COMMENT '密码',
                          `email` varchar(100) DEFAULT NULL COMMENT '邮箱',
                          `phone` varchar(20) DEFAULT NULL COMMENT '电话',
                          `real_name` varchar(50) DEFAULT NULL COMMENT '真实姓名',
                          `role_id` bigint DEFAULT NULL COMMENT '角色ID',
                          `status` tinyint(1) DEFAULT '1' COMMENT '状态:0禁用,1正常',
                          `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
                          `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                          `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                          PRIMARY KEY (`id`),
                          UNIQUE KEY `uk_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='管理员表';

-- ----------------------------
-- Records of admins
-- ----------------------------
BEGIN;
INSERT INTO `admins` (`id`, `username`, `password`, `email`, `phone`, `real_name`, `role_id`, `status`, `last_login_time`, `created_at`, `updated_at`) VALUES (2, 'admin', '$2a$10$MUkorAzhAFMhp1D8leAAlexNvWUWramuHY40qsD2LSdAIe.ja6q9C', 'admin@sunnyfarm.com', '18888888888', '系统管理员', 1, 1, '2025-09-24 20:33:53', '2025-07-16 13:12:09', '2025-09-24 20:33:52');
COMMIT;

-- ----------------------------
-- Table structure for announcements
-- ----------------------------
DROP TABLE IF EXISTS `announcements`;
CREATE TABLE `announcements` (
                                 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '公告ID',
                                 `title` varchar(200) NOT NULL COMMENT '标题',
                                 `content` text NOT NULL COMMENT '内容',
                                 `type` tinyint(1) DEFAULT '1' COMMENT '类型:1系统公告,2活动公告,3维护公告',
                                 `status` tinyint(1) DEFAULT '1' COMMENT '状态:0草稿,1发布',
                                 `publish_time` datetime DEFAULT NULL COMMENT '发布时间',
                                 `creator_id` bigint DEFAULT NULL COMMENT '创建者ID',
                                 `creator_name` varchar(50) DEFAULT NULL COMMENT '创建者名称',
                                 `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='公告表';

-- ----------------------------
-- Records of announcements
-- ----------------------------
BEGIN;
INSERT INTO `announcements` (`id`, `title`, `content`, `type`, `status`, `publish_time`, `creator_id`, `creator_name`, `created_at`, `updated_at`) VALUES (1, '系统维护通知', '系统将于今晚23:00-01:00进行维护，请用户提前做好准备。', 3, 1, '2025-07-18 05:46:23', 1, 'admin', '2025-07-18 05:46:23', '2025-07-18 05:46:23');
INSERT INTO `announcements` (`id`, `title`, `content`, `type`, `status`, `publish_time`, `creator_id`, `creator_name`, `created_at`, `updated_at`) VALUES (2, '春节活动优惠', '春节期间全场商品8折优惠，欢迎选购！', 2, 1, '2025-07-18 05:46:23', 1, 'admin', '2025-07-18 05:46:23', '2025-07-18 05:46:23');
INSERT INTO `announcements` (`id`, `title`, `content`, `type`, `status`, `publish_time`, `creator_id`, `creator_name`, `created_at`, `updated_at`) VALUES (3, '新功能上线', '商家评价功能正式上线，欢迎体验！', 1, 1, '2025-09-24 18:27:48', 1, 'admin', '2025-07-18 05:46:23', '2025-07-18 05:46:23');
COMMIT;

-- ----------------------------
-- Table structure for categories
-- ----------------------------
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories` (
                              `id` bigint NOT NULL AUTO_INCREMENT COMMENT '分类ID',
                              `name` varchar(50) NOT NULL COMMENT '分类名称',
                              `parent_id` bigint DEFAULT '0' COMMENT '父分类ID',
                              `sort_order` int DEFAULT '0' COMMENT '排序',
                              `icon` varchar(255) DEFAULT NULL COMMENT '图标',
                              `description` varchar(200) DEFAULT NULL COMMENT '描述',
                              `status` tinyint(1) DEFAULT '1' COMMENT '状态:0禁用,1启用',
                              `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                              `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                              PRIMARY KEY (`id`),
                              KEY `idx_parent_id` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商品分类表';

-- ----------------------------
-- Records of categories
-- ----------------------------
BEGIN;
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (1, '蔬菜类', 0, 1, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (2, '水果类', 0, 2, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (3, '粮食类', 0, 3, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (4, '畜牧类', 0, 4, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (5, '叶菜类', 1, 1, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (6, '根茎类', 1, 2, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (7, '瓜果类', 1, 3, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (8, '时令水果', 2, 1, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (9, '进口水果', 2, 2, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (10, '大米', 3, 1, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (11, '面粉', 3, 2, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (12, '猪肉', 4, 1, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `categories` (`id`, `name`, `parent_id`, `sort_order`, `icon`, `description`, `status`, `created_at`, `updated_at`) VALUES (13, '鸡肉', 4, 2, NULL, NULL, 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
COMMIT;

-- ----------------------------
-- Table structure for chat_messages
-- ----------------------------
DROP TABLE IF EXISTS `chat_messages`;
CREATE TABLE `chat_messages` (
                                 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '消息ID',
                                 `session_id` bigint NOT NULL COMMENT '会话ID',
                                 `sender_id` bigint NOT NULL COMMENT '发送人ID',
                                 `sender_type` tinyint(1) NOT NULL COMMENT '发送人类型:1用户,2商家',
                                 `message_type` tinyint(1) DEFAULT '1' COMMENT '消息类型:1文本,2图片,3文件',
                                 `content` text NOT NULL COMMENT '消息内容',
                                 `is_read` tinyint(1) DEFAULT '0' COMMENT '是否已读:0未读,1已读',
                                 `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 PRIMARY KEY (`id`),
                                 KEY `idx_session_id` (`session_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='聊天消息表';

-- ----------------------------
-- Records of chat_messages
-- ----------------------------
BEGIN;
INSERT INTO `chat_messages` (`id`, `session_id`, `sender_id`, `sender_type`, `message_type`, `content`, `is_read`, `created_at`) VALUES (1, 1, 1, 1, 1, '你好！\n这个胡萝卜还有吗？', 1, '2025-09-23 22:15:36');
INSERT INTO `chat_messages` (`id`, `session_id`, `sender_id`, `sender_type`, `message_type`, `content`, `is_read`, `created_at`) VALUES (2, 1, 1, 2, 1, '你好！有的有的！', 1, '2025-09-23 22:16:00');
INSERT INTO `chat_messages` (`id`, `session_id`, `sender_id`, `sender_type`, `message_type`, `content`, `is_read`, `created_at`) VALUES (3, 1, 1, 1, 1, '嗯？我想买1000斤！\n', 1, '2025-09-23 22:24:25');
INSERT INTO `chat_messages` (`id`, `session_id`, `sender_id`, `sender_type`, `message_type`, `content`, `is_read`, `created_at`) VALUES (4, 1, 1, 2, 1, '那也有的呀！兄弟！', 1, '2025-09-23 22:24:44');
INSERT INTO `chat_messages` (`id`, `session_id`, `sender_id`, `sender_type`, `message_type`, `content`, `is_read`, `created_at`) VALUES (5, 1, 1, 1, 1, '那我明天要可以不？', 1, '2025-09-23 22:32:30');
INSERT INTO `chat_messages` (`id`, `session_id`, `sender_id`, `sender_type`, `message_type`, `content`, `is_read`, `created_at`) VALUES (6, 1, 1, 2, 1, '可以的可以的！', 1, '2025-09-23 22:32:46');
INSERT INTO `chat_messages` (`id`, `session_id`, `sender_id`, `sender_type`, `message_type`, `content`, `is_read`, `created_at`) VALUES (7, 1, 1, 1, 1, '好的好的！', 1, '2025-09-24 16:56:39');
COMMIT;

-- ----------------------------
-- Table structure for chat_sessions
-- ----------------------------
DROP TABLE IF EXISTS `chat_sessions`;
CREATE TABLE `chat_sessions` (
                                 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '会话ID',
                                 `user_id` bigint NOT NULL COMMENT '用户ID',
                                 `merchant_id` bigint NOT NULL COMMENT '商家ID',
                                 `last_message` text COMMENT '最后一条消息',
                                 `last_message_time` datetime DEFAULT NULL COMMENT '最后消息时间',
                                 `status` tinyint(1) DEFAULT '1' COMMENT '状态:0关闭,1活跃',
                                 `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                 PRIMARY KEY (`id`),
                                 KEY `idx_user_id` (`user_id`),
                                 KEY `idx_merchant_id` (`merchant_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='聊天会话表';

-- ----------------------------
-- Records of chat_sessions
-- ----------------------------
BEGIN;
INSERT INTO `chat_sessions` (`id`, `user_id`, `merchant_id`, `last_message`, `last_message_time`, `status`, `created_at`, `updated_at`) VALUES (1, 1, 1, '好的好的！', '2025-09-24 16:56:39', 1, '2025-09-23 22:02:25', '2025-09-23 22:02:25');
COMMIT;

-- ----------------------------
-- Table structure for favorites
-- ----------------------------
DROP TABLE IF EXISTS `favorites`;
CREATE TABLE `favorites` (
                             `id` bigint NOT NULL AUTO_INCREMENT COMMENT '收藏ID',
                             `user_id` bigint NOT NULL COMMENT '用户ID',
                             `product_id` bigint NOT NULL COMMENT '商品ID',
                             `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                             `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                             PRIMARY KEY (`id`),
                             UNIQUE KEY `uk_user_product` (`user_id`,`product_id`),
                             KEY `idx_user_id` (`user_id`),
                             KEY `idx_product_id` (`product_id`),
                             KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户收藏表';

-- ----------------------------
-- Records of favorites
-- ----------------------------
BEGIN;
INSERT INTO `favorites` (`id`, `user_id`, `product_id`, `created_at`, `updated_at`) VALUES (1, 1, 2, '2025-09-25 03:51:39', '2025-09-25 03:51:39');
COMMIT;

-- ----------------------------
-- Table structure for file_uploads
-- ----------------------------
DROP TABLE IF EXISTS `file_uploads`;
CREATE TABLE `file_uploads` (
                                `id` bigint NOT NULL AUTO_INCREMENT COMMENT '文件ID',
                                `original_name` varchar(255) NOT NULL COMMENT '原始文件名',
                                `file_name` varchar(255) NOT NULL COMMENT '存储文件名',
                                `file_path` varchar(255) NOT NULL COMMENT '文件路径',
                                `file_size` bigint NOT NULL COMMENT '文件大小',
                                `file_type` varchar(50) NOT NULL COMMENT '文件类型',
                                `uploader_id` bigint NOT NULL COMMENT '上传者ID',
                                `uploader_type` tinyint(1) NOT NULL COMMENT '上传者类型:1用户,2商家,3管理员',
                                `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                PRIMARY KEY (`id`),
                                KEY `idx_uploader` (`uploader_id`,`uploader_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='文件上传记录表';

-- ----------------------------
-- Records of file_uploads
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for inventory
-- ----------------------------
DROP TABLE IF EXISTS `inventory`;
CREATE TABLE `inventory` (
                             `id` bigint NOT NULL AUTO_INCREMENT COMMENT '库存ID',
                             `product_id` bigint NOT NULL COMMENT '商品ID',
                             `stock_quantity` int NOT NULL DEFAULT '0' COMMENT '库存数量',
                             `warning_quantity` int DEFAULT '10' COMMENT '预警数量',
                             `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                             PRIMARY KEY (`id`),
                             UNIQUE KEY `uk_product_id` (`product_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='库存管理表';

-- ----------------------------
-- Records of inventory
-- ----------------------------
BEGIN;
INSERT INTO `inventory` (`id`, `product_id`, `stock_quantity`, `warning_quantity`, `updated_at`) VALUES (1, 1, 36, 10, '2025-09-24 23:20:17');
INSERT INTO `inventory` (`id`, `product_id`, `stock_quantity`, `warning_quantity`, `updated_at`) VALUES (2, 2, 97, 10, '2025-09-25 04:22:57');
COMMIT;

-- ----------------------------
-- Table structure for logistics
-- ----------------------------
DROP TABLE IF EXISTS `logistics`;
CREATE TABLE `logistics` (
                             `id` bigint NOT NULL AUTO_INCREMENT COMMENT '物流ID',
                             `order_id` bigint NOT NULL COMMENT '订单ID',
                             `logistics_company_id` bigint NOT NULL COMMENT '物流公司ID',
                             `tracking_number` varchar(50) DEFAULT NULL COMMENT '运单号',
                             `status` tinyint(1) DEFAULT '1' COMMENT '物流状态:1待发货,2已发货,3运输中,4派送中,5已签收',
                             `current_location` varchar(100) DEFAULT NULL COMMENT '当前位置',
                             `estimated_delivery` datetime DEFAULT NULL COMMENT '预计送达时间',
                             `actual_delivery` datetime DEFAULT NULL COMMENT '实际送达时间',
                             `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                             `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                             PRIMARY KEY (`id`),
                             KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='物流信息表';

-- ----------------------------
-- Records of logistics
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for logistics_companies
-- ----------------------------
DROP TABLE IF EXISTS `logistics_companies`;
CREATE TABLE `logistics_companies` (
                                       `id` bigint NOT NULL AUTO_INCREMENT COMMENT '物流公司ID',
                                       `name` varchar(50) NOT NULL COMMENT '公司名称',
                                       `code` varchar(20) NOT NULL COMMENT '公司代码',
                                       `phone` varchar(20) DEFAULT NULL COMMENT '客服电话',
                                       `website` varchar(100) DEFAULT NULL COMMENT '官网',
                                       `status` tinyint(1) DEFAULT '1' COMMENT '状态:0禁用,1启用',
                                       `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                       `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                       PRIMARY KEY (`id`),
                                       UNIQUE KEY `uk_code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='物流公司表';

-- ----------------------------
-- Records of logistics_companies
-- ----------------------------
BEGIN;
INSERT INTO `logistics_companies` (`id`, `name`, `code`, `phone`, `website`, `status`, `created_at`, `updated_at`) VALUES (1, '顺丰速运', 'SF', '95338', 'https://www.sf-express.com', 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `logistics_companies` (`id`, `name`, `code`, `phone`, `website`, `status`, `created_at`, `updated_at`) VALUES (2, '圆通快递', 'YTO', '95554', 'https://www.yto.net.cn', 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `logistics_companies` (`id`, `name`, `code`, `phone`, `website`, `status`, `created_at`, `updated_at`) VALUES (3, '中通快递', 'ZTO', '95311', 'https://www.zto.com', 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `logistics_companies` (`id`, `name`, `code`, `phone`, `website`, `status`, `created_at`, `updated_at`) VALUES (4, '申通快递', 'STO', '95543', 'https://www.sto.cn', 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `logistics_companies` (`id`, `name`, `code`, `phone`, `website`, `status`, `created_at`, `updated_at`) VALUES (5, '韵达快递', 'YD', '95546', 'https://www.yunda.com', 1, '2025-07-16 04:56:56', '2025-07-16 04:56:56');
COMMIT;

-- ----------------------------
-- Table structure for merchants
-- ----------------------------
DROP TABLE IF EXISTS `merchants`;
CREATE TABLE `merchants` (
                             `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商家ID',
                             `user_id` bigint NOT NULL COMMENT '关联用户ID',
                             `shop_name` varchar(100) NOT NULL COMMENT '店铺名称',
                             `business_license` varchar(255) DEFAULT NULL COMMENT '营业执照',
                             `legal_person` varchar(50) DEFAULT NULL COMMENT '法人',
                             `contact_phone` varchar(20) DEFAULT NULL COMMENT '联系电话',
                             `business_scope` varchar(500) DEFAULT NULL COMMENT '经营范围',
                             `address` varchar(200) DEFAULT NULL COMMENT '经营地址',
                             `status` tinyint(1) DEFAULT '0' COMMENT '状态:0待审核,1通过,2拒绝',
                             `verify_time` datetime DEFAULT NULL COMMENT '审核时间',
                             `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                             `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                             PRIMARY KEY (`id`),
                             KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商家信息表';

-- ----------------------------
-- Records of merchants
-- ----------------------------
BEGIN;
INSERT INTO `merchants` (`id`, `user_id`, `shop_name`, `business_license`, `legal_person`, `contact_phone`, `business_scope`, `address`, `status`, `verify_time`, `created_at`, `updated_at`) VALUES (1, 2, '乐天水果店铺', NULL, '狗王之王', '13823680701', '专营东南亚水果，东南亚水果最大的经销商！', '广东省深圳市南山区萧家大院', 1, '2025-07-17 23:19:06', '2025-07-16 12:55:48', '2025-07-17 23:19:06');
COMMIT;

-- ----------------------------
-- Table structure for notifications
-- ----------------------------
DROP TABLE IF EXISTS `notifications`;
CREATE TABLE `notifications` (
                                 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '消息ID',
                                 `user_id` bigint NOT NULL COMMENT '用户ID',
                                 `title` varchar(200) NOT NULL COMMENT '标题',
                                 `content` text NOT NULL COMMENT '内容',
                                 `type` tinyint(1) DEFAULT '1' COMMENT '消息类型:1系统消息,2订单消息,3活动消息',
                                 `is_read` tinyint(1) DEFAULT '0' COMMENT '是否已读:0未读,1已读',
                                 `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 PRIMARY KEY (`id`),
                                 KEY `idx_user_id` (`user_id`),
                                 KEY `idx_is_read` (`is_read`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='站内消息表';

-- ----------------------------
-- Records of notifications
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for order_items
-- ----------------------------
DROP TABLE IF EXISTS `order_items`;
CREATE TABLE `order_items` (
                               `id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单项ID',
                               `order_id` bigint NOT NULL COMMENT '订单ID',
                               `product_id` bigint NOT NULL COMMENT '商品ID',
                               `product_name` varchar(200) NOT NULL COMMENT '商品名称',
                               `product_image` varchar(255) DEFAULT NULL COMMENT '商品图片',
                               `price` decimal(10,2) NOT NULL COMMENT '单价',
                               `quantity` int NOT NULL COMMENT '数量',
                               `total_amount` decimal(10,2) NOT NULL COMMENT '小计',
                               `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                               PRIMARY KEY (`id`),
                               KEY `idx_order_id` (`order_id`),
                               KEY `idx_product_id` (`product_id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订单详情表';

-- ----------------------------
-- Records of order_items
-- ----------------------------
BEGIN;
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (1, 9, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 08:39:36');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (2, 10, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 08:40:07');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (3, 11, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 08:40:15');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (4, 12, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 08:46:04');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (5, 13, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 08:46:08');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (6, 14, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 08:47:45');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (7, 15, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 08:48:35');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (8, 16, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:16:08');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (9, 17, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:21:44');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (10, 18, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:24:37');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (11, 19, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:25:10');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (12, 20, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:26:55');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (13, 21, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:27:32');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (14, 22, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:32:17');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (15, 23, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:45:26');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (16, 24, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 09:53:15');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (17, 25, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 10:47:44');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (18, 26, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 10:59:37');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (19, 27, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 11:04:08');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (20, 28, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-08-26 11:12:12');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (21, 29, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 2, 60.00, '2025-09-05 18:34:38');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (22, 30, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-09-17 17:08:51');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (23, 31, 2, '云南有机萝卜', 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/42f966e9-d0b4-419d-9362-b75f41a9067b.jpg', 15.00, 1, 15.00, '2025-09-24 15:59:53');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (24, 32, 2, '云南有机萝卜', 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/42f966e9-d0b4-419d-9362-b75f41a9067b.jpg', 15.00, 1, 15.00, '2025-09-24 23:10:54');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (25, 33, 1, 'aaa', 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 30.00, 1, 30.00, '2025-09-24 23:20:19');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (26, 34, 2, '云南有机萝卜', 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/42f966e9-d0b4-419d-9362-b75f41a9067b.jpg', 15.00, 1, 15.00, '2025-09-25 04:08:23');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (27, 35, 2, '云南有机萝卜', 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/42f966e9-d0b4-419d-9362-b75f41a9067b.jpg', 15.00, 1, 15.00, '2025-09-25 04:14:08');
INSERT INTO `order_items` (`id`, `order_id`, `product_id`, `product_name`, `product_image`, `price`, `quantity`, `total_amount`, `created_at`) VALUES (28, 36, 2, '云南有机萝卜', 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/42f966e9-d0b4-419d-9362-b75f41a9067b.jpg', 15.00, 1, 15.00, '2025-09-25 04:22:57');
COMMIT;

-- ----------------------------
-- Table structure for order_status_logs
-- ----------------------------
DROP TABLE IF EXISTS `order_status_logs`;
CREATE TABLE `order_status_logs` (
                                     `id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志ID',
                                     `order_id` bigint NOT NULL COMMENT '订单ID',
                                     `status` tinyint(1) NOT NULL COMMENT '状态',
                                     `remark` varchar(255) DEFAULT NULL COMMENT '备注',
                                     `operator_id` bigint DEFAULT NULL COMMENT '操作人ID',
                                     `operator_type` tinyint(1) DEFAULT '1' COMMENT '操作人类型:1用户,2商家,3管理员',
                                     `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                     PRIMARY KEY (`id`),
                                     KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订单状态变更日志表';

-- ----------------------------
-- Records of order_status_logs
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
                          `id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单ID',
                          `order_no` varchar(32) NOT NULL COMMENT '订单号',
                          `user_id` bigint NOT NULL COMMENT '用户ID',
                          `merchant_id` bigint NOT NULL COMMENT '商家ID',
                          `total_amount` decimal(10,2) NOT NULL COMMENT '总金额',
                          `discount_amount` decimal(10,2) DEFAULT '0.00' COMMENT '优惠金额',
                          `actual_amount` decimal(10,2) NOT NULL COMMENT '实付金额',
                          `status` tinyint(1) DEFAULT '1' COMMENT '订单状态:1待支付,2已支付,3已发货,4已完成,5已取消,6已退款',
                          `consignee` varchar(50) NOT NULL COMMENT '收件人',
                          `phone` varchar(20) NOT NULL COMMENT '联系电话',
                          `address` varchar(200) NOT NULL COMMENT '收货地址',
                          `remark` varchar(500) DEFAULT NULL COMMENT '备注',
                          `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                          `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                          `pay_time` datetime DEFAULT NULL COMMENT '支付时间',
                          `pay_transaction_id` varchar(64) DEFAULT NULL COMMENT '支付交易ID',
                          `ship_time` datetime DEFAULT NULL COMMENT '发货时间',
                          `ship_company` varchar(50) DEFAULT NULL COMMENT '物流公司',
                          `ship_no` varchar(50) DEFAULT NULL COMMENT '运单号',
                          `receive_time` datetime DEFAULT NULL COMMENT '收货时间',
                          `finish_time` datetime DEFAULT NULL COMMENT '完成时间',
                          `cancel_time` datetime DEFAULT NULL COMMENT '取消时间',
                          `cancel_reason` varchar(500) DEFAULT NULL COMMENT '取消原因',
                          `refund_reason` varchar(500) DEFAULT NULL COMMENT '退款原因',
                          `refund_amount` decimal(10,2) DEFAULT NULL COMMENT '退款金额',
                          `refund_time` datetime DEFAULT NULL COMMENT '退款时间',
                          PRIMARY KEY (`id`),
                          UNIQUE KEY `uk_order_no` (`order_no`),
                          KEY `idx_user_id` (`user_id`),
                          KEY `idx_merchant_id` (`merchant_id`),
                          KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='订单主表';

-- ----------------------------
-- Records of orders
-- ----------------------------
BEGIN;
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (9, 'O202508260839360001', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 08:39:36', '2025-08-26 08:39:36', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (10, 'O202508260840070002', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 08:40:07', '2025-08-26 08:40:07', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (11, 'O202508260840150003', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 08:40:15', '2025-08-26 08:40:15', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (12, 'O202508260846030001', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 08:46:04', '2025-08-26 08:46:04', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (13, 'O202508260846080002', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 08:46:08', '2025-08-26 08:46:08', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (14, 'O202508260847450003', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 08:47:45', '2025-08-26 08:47:45', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (15, 'O202508260848350004', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 08:48:35', '2025-08-26 08:48:35', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (16, 'O202508260916080001', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:16:08', '2025-08-26 09:16:08', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (17, 'O202508260921440001', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:21:44', '2025-08-26 09:21:44', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (18, 'O202508260924370002', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:24:37', '2025-08-26 09:24:37', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (19, 'O202508260925100001', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:25:10', '2025-08-26 09:25:10', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (20, 'O202508260926550001', 1, 1, 30.00, 0.00, 30.00, 4, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:26:55', '2025-08-26 09:26:55', '2025-08-26 09:27:01', 'PAY_1756171621066', '2025-09-24 22:18:29', '圆通快递', 'YT34289742332', '2025-09-24 22:18:38', '2025-09-24 22:18:38', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (21, 'O202508260927310002', 1, 1, 30.00, 0.00, 30.00, 4, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:27:32', '2025-08-26 09:27:32', '2025-08-26 09:27:46', 'PAY_1756171665901', '2025-09-24 20:50:56', '顺丰快递', 'sf1234543654645', '2025-09-24 20:51:03', '2025-09-24 20:51:03', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (22, 'O202508260932160001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:32:16', '2025-08-26 09:32:16', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:55', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (23, 'O202508260945240001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:45:26', '2025-08-26 09:45:26', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:51', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (24, 'O202508260953130001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 09:53:15', '2025-08-26 09:53:15', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:49', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (25, 'O202508261047420001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 10:47:44', '2025-08-26 10:47:44', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:52', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (26, 'O202508261059350001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 10:59:37', '2025-08-26 10:59:37', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:46', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (27, 'O202508261104060001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 11:04:08', '2025-08-26 11:04:08', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:44', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (28, 'O202508261112090001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-08-26 11:12:12', '2025-08-26 11:12:12', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:41', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (29, 'O202509051834590001', 1, 1, 60.00, 0.00, 60.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-05 18:34:38', '2025-09-05 18:34:38', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:39', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (30, 'O202509171708500001', 1, 1, 30.00, 0.00, 30.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-17 17:08:51', '2025-09-17 17:08:51', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:25:36', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (31, 'O202509241559530001', 1, 1, 15.00, 0.00, 15.00, 2, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-24 15:59:53', '2025-09-24 23:01:47', '2025-09-24 23:01:47', '2025092422001418170507460642', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (32, 'O202509242310530001', 1, 1, 15.00, 0.00, 15.00, 2, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-24 23:10:54', '2025-09-24 23:19:12', '2025-09-24 23:19:12', '待补充支付宝交易号', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (33, 'O202509242320170001', 1, 1, 30.00, 0.00, 30.00, 1, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-24 23:20:19', '2025-09-24 23:20:19', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (34, 'O202509250408230001', 1, 1, 15.00, 0.00, 15.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-25 04:08:23', '2025-09-25 04:08:23', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-25 04:14:01', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (35, 'O202509250414080002', 1, 1, 15.00, 0.00, 15.00, 5, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-25 04:14:08', '2025-09-25 04:14:08', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-25 04:22:50', '用户取消', NULL, NULL, NULL);
INSERT INTO `orders` (`id`, `order_no`, `user_id`, `merchant_id`, `total_amount`, `discount_amount`, `actual_amount`, `status`, `consignee`, `phone`, `address`, `remark`, `created_at`, `updated_at`, `pay_time`, `pay_transaction_id`, `ship_time`, `ship_company`, `ship_no`, `receive_time`, `finish_time`, `cancel_time`, `cancel_reason`, `refund_reason`, `refund_amount`, `refund_time`) VALUES (36, 'O202509250422570003', 1, 1, 15.00, 0.00, 15.00, 2, '施琦大王', '17816786725', '广东省深圳市南山区政府大院2楼', '', '2025-09-25 04:22:57', '2025-09-25 05:17:26', '2025-09-25 05:17:26', 'TEST_TRADE_SUCCESS', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
COMMIT;

-- ----------------------------
-- Table structure for payments
-- ----------------------------
DROP TABLE IF EXISTS `payments`;
CREATE TABLE `payments` (
                            `id` bigint NOT NULL AUTO_INCREMENT COMMENT '支付ID',
                            `order_id` bigint NOT NULL COMMENT '订单ID',
                            `payment_no` varchar(32) NOT NULL COMMENT '支付单号',
                            `payment_method` varchar(20) NOT NULL COMMENT '支付方式',
                            `amount` decimal(10,2) NOT NULL COMMENT '支付金额',
                            `status` tinyint(1) DEFAULT '1' COMMENT '支付状态:1待支付,2已支付,3支付失败,4已退款',
                            `trade_no` varchar(64) DEFAULT NULL COMMENT '第三方交易号',
                            `alipay_trade_no` varchar(64) DEFAULT NULL COMMENT '支付宝交易号',
                            `buyer_pay_amount` varchar(20) DEFAULT NULL COMMENT '买家实付金额',
                            `buyer_logon_id` varchar(100) DEFAULT NULL COMMENT '买家支付宝账号',
                            `refund_amount` decimal(10,2) DEFAULT NULL COMMENT '退款金额',
                            `refund_time` datetime DEFAULT NULL COMMENT '退款时间',
                            `refund_reason` varchar(500) DEFAULT NULL COMMENT '退款原因',
                            `paid_at` datetime DEFAULT NULL COMMENT '支付时间',
                            `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                            `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                            PRIMARY KEY (`id`),
                            UNIQUE KEY `uk_payment_no` (`payment_no`),
                            KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='支付记录表';

-- ----------------------------
-- Records of payments
-- ----------------------------
BEGIN;
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (1, 22, 'P202508260932190002', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-08-26 09:32:19', '2025-08-26 09:32:19');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (2, 25, 'P202508261047450002', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-08-26 10:47:47', '2025-08-26 10:47:47');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (3, 25, 'P202508261049370003', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-08-26 10:49:39', '2025-08-26 10:49:39');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (4, 26, 'P202508261059380002', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-08-26 10:59:40', '2025-08-26 10:59:40');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (5, 27, 'P202508261104090002', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-08-26 11:04:11', '2025-08-26 11:04:11');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (6, 28, 'P202508261112120002', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-08-26 11:12:14', '2025-08-26 11:12:14');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (7, 29, 'P202509051835040002', 'alipay', 60.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-05 18:34:43', '2025-09-05 18:34:43');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (8, 30, 'P202509171708540002', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-17 17:08:54', '2025-09-17 17:08:54');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (9, 30, 'P202509232021240001', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-23 20:21:24', '2025-09-23 20:21:24');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (10, 31, 'P202509242230110001', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:30:12', '2025-09-24 22:30:12');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (11, 31, 'P202509242231350002', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:31:35', '2025-09-24 22:31:35');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (12, 31, 'P202509242233560003', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:33:56', '2025-09-24 22:33:56');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (13, 31, 'P202509242235460001', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:35:46', '2025-09-24 22:35:46');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (14, 31, 'P202509242237320002', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:37:32', '2025-09-24 22:37:32');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (15, 31, 'P202509242245360003', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:45:36', '2025-09-24 22:45:36');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (16, 31, 'P202509242247450001', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:47:45', '2025-09-24 22:47:45');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (17, 31, 'P202509242248550002', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:48:55', '2025-09-24 22:48:55');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (18, 31, 'P202509242256180003', 'alipay', 15.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 22:56:18', '2025-09-24 22:56:18');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (19, 31, 'P202509242258180001', 'alipay', 15.00, 2, '2025092422001418170507460642', '2025092422001418170507460642', NULL, NULL, NULL, NULL, NULL, '2025-09-24 23:01:47', '2025-09-24 22:58:18', '2025-09-24 23:01:47');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (21, 32, 'P202509242311480003', 'alipay', 15.00, 2, '待补充支付宝交易号', NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-24 23:19:12', '2025-09-24 23:11:48', '2025-09-24 23:19:12');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (24, 36, 'P202509250447160002', 'alipay', 15.00, 2, 'TEST_TRADE_SUCCESS', NULL, '10.00', NULL, NULL, NULL, NULL, '2025-09-25 05:17:26', '2025-09-25 04:47:16', '2025-09-25 05:17:26');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (25, 33, 'P202509250519010001', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-25 05:19:01', '2025-09-25 05:19:01');
INSERT INTO `payments` (`id`, `order_id`, `payment_no`, `payment_method`, `amount`, `status`, `trade_no`, `alipay_trade_no`, `buyer_pay_amount`, `buyer_logon_id`, `refund_amount`, `refund_time`, `refund_reason`, `paid_at`, `created_at`, `updated_at`) VALUES (26, 19, 'P202509250520120002', 'alipay', 30.00, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2025-09-25 05:20:12', '2025-09-25 05:20:12');
COMMIT;

-- ----------------------------
-- Table structure for permissions
-- ----------------------------
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
                               `id` bigint NOT NULL AUTO_INCREMENT COMMENT '权限ID',
                               `name` varchar(50) NOT NULL COMMENT '权限名称',
                               `code` varchar(50) NOT NULL COMMENT '权限代码',
                               `type` tinyint(1) DEFAULT '1' COMMENT '权限类型:1菜单,2按钮,3接口',
                               `parent_id` bigint DEFAULT '0' COMMENT '父权限ID',
                               `path` varchar(100) DEFAULT NULL COMMENT '路径',
                               `description` varchar(200) DEFAULT NULL COMMENT '描述',
                               `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                               `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                               PRIMARY KEY (`id`),
                               UNIQUE KEY `uk_code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='权限表';

-- ----------------------------
-- Records of permissions
-- ----------------------------
BEGIN;
INSERT INTO `permissions` (`id`, `name`, `code`, `type`, `parent_id`, `path`, `description`, `created_at`, `updated_at`) VALUES (1, '用户管理', 'USER_MANAGE', 1, 0, '/admin/users', '用户管理菜单', '2025-07-16 12:50:43', '2025-07-16 12:50:43');
INSERT INTO `permissions` (`id`, `name`, `code`, `type`, `parent_id`, `path`, `description`, `created_at`, `updated_at`) VALUES (2, '商家管理', 'MERCHANT_MANAGE', 1, 0, '/admin/merchants', '商家管理菜单', '2025-07-16 12:50:43', '2025-07-16 12:50:43');
INSERT INTO `permissions` (`id`, `name`, `code`, `type`, `parent_id`, `path`, `description`, `created_at`, `updated_at`) VALUES (3, '商品管理', 'PRODUCT_MANAGE', 1, 0, '/admin/products', '商品管理菜单', '2025-07-16 12:50:43', '2025-07-16 12:50:43');
INSERT INTO `permissions` (`id`, `name`, `code`, `type`, `parent_id`, `path`, `description`, `created_at`, `updated_at`) VALUES (4, '订单管理', 'ORDER_MANAGE', 1, 0, '/admin/orders', '订单管理菜单', '2025-07-16 12:50:43', '2025-07-16 12:50:43');
INSERT INTO `permissions` (`id`, `name`, `code`, `type`, `parent_id`, `path`, `description`, `created_at`, `updated_at`) VALUES (5, '数据统计', 'STATISTICS', 1, 0, '/admin/statistics', '数据统计菜单', '2025-07-16 12:50:43', '2025-07-16 12:50:43');
INSERT INTO `permissions` (`id`, `name`, `code`, `type`, `parent_id`, `path`, `description`, `created_at`, `updated_at`) VALUES (6, '系统设置', 'SYSTEM_SETTING', 1, 0, '/admin/settings', '系统设置菜单', '2025-07-16 12:50:43', '2025-07-16 12:50:43');
COMMIT;

-- ----------------------------
-- Table structure for product_images
-- ----------------------------
DROP TABLE IF EXISTS `product_images`;
CREATE TABLE `product_images` (
                                  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '图片ID',
                                  `product_id` bigint NOT NULL COMMENT '商品ID',
                                  `image_url` varchar(255) NOT NULL COMMENT '图片URL',
                                  `is_main` tinyint(1) DEFAULT '0' COMMENT '是否主图:0否,1是',
                                  `sort_order` int DEFAULT '0' COMMENT '排序',
                                  `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                  PRIMARY KEY (`id`),
                                  KEY `idx_product_id` (`product_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商品图片表';

-- ----------------------------
-- Records of product_images
-- ----------------------------
BEGIN;
INSERT INTO `product_images` (`id`, `product_id`, `image_url`, `is_main`, `sort_order`, `created_at`) VALUES (3, 1, 'https://sunnyfarm-1328510989.cos.ap-guangzhou.myqcloud.com/uploads/2025/07/18/4eae7138-0760-41bd-b76d-a99630ce84fa.jpg', 1, 0, '2025-09-23 16:33:59');
INSERT INTO `product_images` (`id`, `product_id`, `image_url`, `is_main`, `sort_order`, `created_at`) VALUES (7, 2, 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/42f966e9-d0b4-419d-9362-b75f41a9067b.jpg', 1, 0, '2025-09-23 17:47:32');
INSERT INTO `product_images` (`id`, `product_id`, `image_url`, `is_main`, `sort_order`, `created_at`) VALUES (8, 2, 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/016ca434-a729-4ba8-bdfb-f35429a9c1e1.jpg', 0, 1, '2025-09-23 17:47:32');
INSERT INTO `product_images` (`id`, `product_id`, `image_url`, `is_main`, `sort_order`, `created_at`) VALUES (9, 2, 'https://cdnsunnyfarm.sqai.online/uploads/2025/09/23/e1a1b427-c248-4385-b9a9-72e4cee5e58b.jpg', 0, 2, '2025-09-23 17:47:32');
COMMIT;

-- ----------------------------
-- Table structure for products
-- ----------------------------
DROP TABLE IF EXISTS `products`;
CREATE TABLE `products` (
                            `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品ID',
                            `merchant_id` bigint NOT NULL COMMENT '商家ID',
                            `category_id` bigint NOT NULL COMMENT '分类ID',
                            `name` varchar(200) NOT NULL COMMENT '商品名称',
                            `description` text COMMENT '商品描述',
                            `price` decimal(10,2) NOT NULL COMMENT '价格',
                            `origin_price` decimal(10,2) DEFAULT NULL COMMENT '原价',
                            `origin` varchar(100) DEFAULT NULL COMMENT '产地',
                            `unit` varchar(20) DEFAULT NULL COMMENT '单位',
                            `weight` varchar(50) DEFAULT NULL COMMENT '重量',
                            `shelf_life` varchar(50) DEFAULT NULL COMMENT '保质期',
                            `storage_method` varchar(100) DEFAULT NULL COMMENT '储存方式',
                            `status` tinyint(1) DEFAULT '0' COMMENT '状态:0审核中,1上架,2下架',
                            `sort_order` int DEFAULT '0' COMMENT '排序',
                            `sales_count` int DEFAULT '0' COMMENT '销量',
                            `view_count` int DEFAULT '0' COMMENT '浏览量',
                            `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                            `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                            PRIMARY KEY (`id`),
                            KEY `idx_merchant_id` (`merchant_id`),
                            KEY `idx_category_id` (`category_id`),
                            KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='商品信息表';

-- ----------------------------
-- Records of products
-- ----------------------------
BEGIN;
INSERT INTO `products` (`id`, `merchant_id`, `category_id`, `name`, `description`, `price`, `origin_price`, `origin`, `unit`, `weight`, `shelf_life`, `storage_method`, `status`, `sort_order`, `sales_count`, `view_count`, `created_at`, `updated_at`) VALUES (1, 1, 5, 'aaa', 'test', 30.00, 40.00, '深圳', '斤', '500g/斤', '6天', '常温', 1, 0, 0, 118, '2025-07-18 07:39:30', '2025-09-23 17:48:00');
INSERT INTO `products` (`id`, `merchant_id`, `category_id`, `name`, `description`, `price`, `origin_price`, `origin`, `unit`, `weight`, `shelf_life`, `storage_method`, `status`, `sort_order`, `sales_count`, `view_count`, `created_at`, `updated_at`) VALUES (2, 1, 6, '云南有机萝卜', '云南有机大萝卜，吃的更放心！', 15.00, 15.00, '云南', '斤', '500g', '7 天', '常温保存', 1, 0, 0, 121, '2025-09-23 17:47:20', '2025-09-23 17:48:03');
COMMIT;

-- ----------------------------
-- Table structure for reviews
-- ----------------------------
DROP TABLE IF EXISTS `reviews`;
CREATE TABLE `reviews` (
                           `id` bigint NOT NULL AUTO_INCREMENT COMMENT '评价ID',
                           `order_id` bigint NOT NULL COMMENT '订单ID',
                           `user_id` bigint NOT NULL COMMENT '用户ID',
                           `product_id` bigint NOT NULL COMMENT '商品ID',
                           `merchant_id` bigint NOT NULL COMMENT '商家ID',
                           `rating` tinyint(1) NOT NULL COMMENT '评分:1-5星',
                           `content` text COMMENT '评价内容',
                           `reply` text COMMENT '商家回复',
                           `reply_time` datetime DEFAULT NULL COMMENT '回复时间',
                           `status` tinyint(1) DEFAULT '1' COMMENT '状态:0隐藏,1显示',
                           `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                           `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                           PRIMARY KEY (`id`),
                           KEY `idx_order_id` (`order_id`),
                           KEY `idx_user_id` (`user_id`),
                           KEY `idx_product_id` (`product_id`),
                           KEY `idx_merchant_id` (`merchant_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='评价表';

-- ----------------------------
-- Records of reviews
-- ----------------------------
BEGIN;
INSERT INTO `reviews` (`id`, `order_id`, `user_id`, `product_id`, `merchant_id`, `rating`, `content`, `reply`, `reply_time`, `status`, `created_at`, `updated_at`) VALUES (1, 21, 1, 1, 1, 5, '书本非常好吃！我太爱了，太好吃了！哈哈哈哈！', NULL, NULL, 1, '2025-09-24 21:23:28', '2025-09-24 21:23:28');
INSERT INTO `reviews` (`id`, `order_id`, `user_id`, `product_id`, `merchant_id`, `rating`, `content`, `reply`, `reply_time`, `status`, `created_at`, `updated_at`) VALUES (2, 20, 1, 1, 1, 5, '书本非常好看！孩子每天都看！', NULL, NULL, 1, '2025-09-24 22:28:02', '2025-09-24 22:28:02');
COMMIT;

-- ----------------------------
-- Table structure for role_permissions
-- ----------------------------
DROP TABLE IF EXISTS `role_permissions`;
CREATE TABLE `role_permissions` (
                                    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '关联ID',
                                    `role_id` bigint NOT NULL COMMENT '角色ID',
                                    `permission_id` bigint NOT NULL COMMENT '权限ID',
                                    `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                    PRIMARY KEY (`id`),
                                    KEY `idx_role_id` (`role_id`),
                                    KEY `idx_permission_id` (`permission_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色权限关联表';

-- ----------------------------
-- Records of role_permissions
-- ----------------------------
BEGIN;
INSERT INTO `role_permissions` (`id`, `role_id`, `permission_id`, `created_at`) VALUES (1, 1, 1, '2025-07-16 12:50:43');
INSERT INTO `role_permissions` (`id`, `role_id`, `permission_id`, `created_at`) VALUES (2, 1, 2, '2025-07-16 12:50:43');
INSERT INTO `role_permissions` (`id`, `role_id`, `permission_id`, `created_at`) VALUES (3, 1, 3, '2025-07-16 12:50:43');
INSERT INTO `role_permissions` (`id`, `role_id`, `permission_id`, `created_at`) VALUES (4, 1, 4, '2025-07-16 12:50:43');
INSERT INTO `role_permissions` (`id`, `role_id`, `permission_id`, `created_at`) VALUES (5, 1, 5, '2025-07-16 12:50:43');
INSERT INTO `role_permissions` (`id`, `role_id`, `permission_id`, `created_at`) VALUES (6, 1, 6, '2025-07-16 12:50:43');
COMMIT;

-- ----------------------------
-- Table structure for roles
-- ----------------------------
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
                         `id` bigint NOT NULL AUTO_INCREMENT COMMENT '角色ID',
                         `name` varchar(50) NOT NULL COMMENT '角色名称',
                         `code` varchar(50) NOT NULL COMMENT '角色代码',
                         `description` varchar(200) DEFAULT NULL COMMENT '描述',
                         `status` tinyint(1) DEFAULT '1' COMMENT '状态:0禁用,1启用',
                         `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                         `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                         PRIMARY KEY (`id`),
                         UNIQUE KEY `uk_code` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色表';

-- ----------------------------
-- Records of roles
-- ----------------------------
BEGIN;
INSERT INTO `roles` (`id`, `name`, `code`, `description`, `status`, `created_at`, `updated_at`) VALUES (1, '超级管理员', 'SUPER_ADMIN', '拥有所有权限的超级管理员', 1, '2025-07-16 12:50:39', '2025-07-16 12:50:39');
INSERT INTO `roles` (`id`, `name`, `code`, `description`, `status`, `created_at`, `updated_at`) VALUES (2, '运营管理员', 'OPERATION_ADMIN', '负责平台运营管理', 1, '2025-07-16 12:50:39', '2025-07-16 12:50:39');
INSERT INTO `roles` (`id`, `name`, `code`, `description`, `status`, `created_at`, `updated_at`) VALUES (3, '客服管理员', 'SERVICE_ADMIN', '负责客服相关工作', 1, '2025-07-16 12:50:39', '2025-07-16 12:50:39');
COMMIT;

-- ----------------------------
-- Table structure for shopping_cart
-- ----------------------------
DROP TABLE IF EXISTS `shopping_cart`;
CREATE TABLE `shopping_cart` (
                                 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '购物车ID',
                                 `user_id` bigint NOT NULL COMMENT '用户ID',
                                 `product_id` bigint NOT NULL COMMENT '商品ID',
                                 `quantity` int NOT NULL DEFAULT '1' COMMENT '数量',
                                 `selected` tinyint(1) DEFAULT '0' COMMENT '是否选中:0否,1是',
                                 `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                 `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                 PRIMARY KEY (`id`),
                                 KEY `idx_user_id` (`user_id`),
                                 KEY `idx_product_id` (`product_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='购物车表';

-- ----------------------------
-- Records of shopping_cart
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for statistics_daily
-- ----------------------------
DROP TABLE IF EXISTS `statistics_daily`;
CREATE TABLE `statistics_daily` (
                                    `id` bigint NOT NULL AUTO_INCREMENT COMMENT '统计ID',
                                    `date` date NOT NULL COMMENT '日期',
                                    `total_users` int DEFAULT '0' COMMENT '总用户数',
                                    `new_users` int DEFAULT '0' COMMENT '新增用户数',
                                    `total_orders` int DEFAULT '0' COMMENT '总订单数',
                                    `total_sales` decimal(15,2) DEFAULT '0.00' COMMENT '总销售额',
                                    `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                    PRIMARY KEY (`id`),
                                    UNIQUE KEY `uk_date` (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='每日统计表';

-- ----------------------------
-- Records of statistics_daily
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for system_configs
-- ----------------------------
DROP TABLE IF EXISTS `system_configs`;
CREATE TABLE `system_configs` (
                                  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '配置ID',
                                  `config_key` varchar(100) NOT NULL COMMENT '配置键',
                                  `config_value` text COMMENT '配置值',
                                  `config_type` varchar(20) DEFAULT 'string' COMMENT '配置类型',
                                  `description` varchar(200) DEFAULT NULL COMMENT '描述',
                                  `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                  PRIMARY KEY (`id`),
                                  UNIQUE KEY `uk_config_key` (`config_key`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统配置表';

-- ----------------------------
-- Records of system_configs
-- ----------------------------
BEGIN;
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `config_type`, `description`, `created_at`, `updated_at`) VALUES (1, 'site_name', '农产品直销平台', 'string', '网站名称', '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `config_type`, `description`, `created_at`, `updated_at`) VALUES (2, 'site_logo', '', 'string', '网站Logo', '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `config_type`, `description`, `created_at`, `updated_at`) VALUES (3, 'site_description', '新鲜农产品直销平台', 'string', '网站描述', '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `config_type`, `description`, `created_at`, `updated_at`) VALUES (4, 'contact_phone', '400-888-8888', 'string', '客服电话', '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `config_type`, `description`, `created_at`, `updated_at`) VALUES (5, 'contact_email', 'service@farm.com', 'string', '客服邮箱', '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `config_type`, `description`, `created_at`, `updated_at`) VALUES (6, 'auto_confirm_days', '7', 'number', '自动确认收货天数', '2025-07-16 04:56:56', '2025-07-16 04:56:56');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `config_type`, `description`, `created_at`, `updated_at`) VALUES (7, 'max_cart_items', '50', 'number', '购物车最大商品数', '2025-07-16 04:56:56', '2025-07-16 04:56:56');
COMMIT;

-- ----------------------------
-- Table structure for system_logs
-- ----------------------------
DROP TABLE IF EXISTS `system_logs`;
CREATE TABLE `system_logs` (
                               `id` bigint NOT NULL AUTO_INCREMENT COMMENT '日志ID',
                               `operation_type` varchar(50) NOT NULL COMMENT '操作类型',
                               `operation_desc` varchar(500) NOT NULL COMMENT '操作描述',
                               `operator_id` bigint DEFAULT NULL COMMENT '操作者ID',
                               `operator_name` varchar(50) DEFAULT NULL COMMENT '操作者名称',
                               `operator_type` tinyint(1) DEFAULT '1' COMMENT '操作者类型:1普通用户,2商家,3管理员,4系统',
                               `target_type` varchar(50) DEFAULT NULL COMMENT '操作目标类型',
                               `target_id` bigint DEFAULT NULL COMMENT '操作目标ID',
                               `ip_address` varchar(45) DEFAULT NULL COMMENT 'IP地址',
                               `user_agent` varchar(500) DEFAULT NULL COMMENT '用户代理',
                               `result` tinyint(1) DEFAULT '1' COMMENT '操作结果:0失败,1成功',
                               `error_msg` varchar(1000) DEFAULT NULL COMMENT '错误信息',
                               `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                               `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                               PRIMARY KEY (`id`),
                               KEY `idx_operation_type` (`operation_type`),
                               KEY `idx_operator` (`operator_id`,`operator_type`),
                               KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='系统操作日志表';

-- ----------------------------
-- Records of system_logs
-- ----------------------------
BEGIN;
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (6, 'user_register', '用户张三完成注册', 1, '张三', 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 05:51:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (7, 'merchant_register', '商家绿色农场提交入驻申请', 2, '绿色农场', 2, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 05:41:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (8, 'admin_login', '管理员登录成功', 1, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 05:26:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (9, 'product_create', '商品有机西红柿创建成功', 2, '绿色农场', 2, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 05:11:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (10, 'merchant_audit', '商家有机蔬菜合作社审核通过', 1, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 04:56:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (11, 'product_audit', '商品有机黄瓜审核通过', 1, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 04:41:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (12, 'order_create', '订单ORDER20241218001创建成功', 3, '李四', 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 04:26:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (13, 'system_config', '更新系统配置', 1, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 04:11:27', '2025-07-18 05:56:27');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (14, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 06:15:05', '2025-07-18 06:15:05');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (15, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 07:42:23', '2025-07-18 07:42:23');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (16, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 07:43:03', '2025-07-18 07:43:03');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (17, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 07:47:39', '2025-07-18 07:47:39');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (18, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 07:54:38', '2025-07-18 07:54:38');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (19, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 08:39:42', '2025-07-18 08:39:42');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (20, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 08:40:00', '2025-07-18 08:40:00');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (21, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 08:48:29', '2025-07-18 08:48:29');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (22, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-07-18 08:49:51', '2025-07-18 08:49:51');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (23, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-22 06:41:14', '2025-08-22 06:41:14');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (24, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-22 06:41:37', '2025-08-22 06:41:37');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (25, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-24 18:35:09', '2025-08-24 18:35:09');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (26, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-24 21:30:24', '2025-08-24 21:30:24');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (27, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-24 21:30:24', '2025-08-24 21:30:24');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (28, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-25 23:59:07', '2025-08-25 23:59:07');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (29, 'order_create', '订单创建成功：O202508260839360001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 08:39:37', '2025-08-26 08:39:37');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (30, 'order_create', '订单创建成功：O202508260840070002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 08:40:08', '2025-08-26 08:40:08');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (31, 'order_create', '订单创建成功：O202508260840150003', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 08:40:16', '2025-08-26 08:40:16');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (32, 'order_create', '订单创建成功：O202508260846030001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 08:46:04', '2025-08-26 08:46:04');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (33, 'order_create', '订单创建成功：O202508260846080002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 08:46:09', '2025-08-26 08:46:09');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (34, 'order_create', '订单创建成功：O202508260847450003', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 08:47:45', '2025-08-26 08:47:45');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (35, 'order_create', '订单创建成功：O202508260848350004', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 08:48:35', '2025-08-26 08:48:35');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (36, 'order_create', '订单创建成功：O202508260916080001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:16:09', '2025-08-26 09:16:09');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (37, 'order_create', '订单创建成功：O202508260921440001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:21:45', '2025-08-26 09:21:45');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (38, 'order_create', '订单创建成功：O202508260924370002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:24:38', '2025-08-26 09:24:38');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (39, 'order_create', '订单创建成功：O202508260925100001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:25:10', '2025-08-26 09:25:10');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (40, 'order_create', '订单创建成功：O202508260926550001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:26:56', '2025-08-26 09:26:56');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (41, 'order_pay', '订单支付成功：O202508260926550001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:27:01', '2025-08-26 09:27:01');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (42, 'order_create', '订单创建成功：O202508260927310002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:27:32', '2025-08-26 09:27:32');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (43, 'order_pay', '订单支付成功：O202508260927310002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:27:46', '2025-08-26 09:27:46');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (44, 'order_create', '订单创建成功：O202508260932160001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:32:17', '2025-08-26 09:32:17');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (45, 'order_create', '订单创建成功：O202508260945240001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:45:25', '2025-08-26 09:45:25');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (46, 'order_create', '订单创建成功：O202508260953130001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 09:53:13', '2025-08-26 09:53:13');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (47, 'order_create', '订单创建成功：O202508261047420001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 10:47:43', '2025-08-26 10:47:43');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (48, 'order_create', '订单创建成功：O202508261059350001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 10:59:36', '2025-08-26 10:59:36');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (49, 'order_create', '订单创建成功：O202508261104060001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 11:04:07', '2025-08-26 11:04:07');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (50, 'order_create', '订单创建成功：O202508261112090001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-08-26 11:12:10', '2025-08-26 11:12:10');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (51, 'order_create', '订单创建成功：O202509051834590001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-05 18:34:59', '2025-09-05 18:34:59');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (52, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-07 23:36:55', '2025-09-07 23:36:55');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (53, 'order_create', '订单创建成功：O202509171708500001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-17 17:08:51', '2025-09-17 17:08:51');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (54, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 17:47:53', '2025-09-23 17:47:53');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (55, 'product_audit', '商品审核通过: aaa', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 17:48:00', '2025-09-23 17:48:00');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (56, 'product_audit', '商品审核通过: 云南有机萝卜', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 17:48:04', '2025-09-23 17:48:04');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (57, 'order_cancel', '订单取消成功：O202509171708500001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:36', '2025-09-23 20:25:36');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (58, 'order_cancel', '订单取消成功：O202509051834590001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:39', '2025-09-23 20:25:39');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (59, 'order_cancel', '订单取消成功：O202508261112090001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:42', '2025-09-23 20:25:42');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (60, 'order_cancel', '订单取消成功：O202508261104060001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:44', '2025-09-23 20:25:44');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (61, 'order_cancel', '订单取消成功：O202508261059350001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:46', '2025-09-23 20:25:46');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (62, 'order_cancel', '订单取消成功：O202508260953130001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:49', '2025-09-23 20:25:49');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (63, 'order_cancel', '订单取消成功：O202508260945240001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:51', '2025-09-23 20:25:51');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (64, 'order_cancel', '订单取消成功：O202508261047420001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:52', '2025-09-23 20:25:52');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (65, 'order_cancel', '订单取消成功：O202508260932160001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-23 20:25:55', '2025-09-23 20:25:55');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (66, 'order_create', '订单创建成功：O202509241559530001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 15:59:54', '2025-09-24 15:59:54');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (67, 'announcement_update', '更新公告: 新功能上线', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 18:27:37', '2025-09-24 18:27:37');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (68, 'announcement_update', '更新公告: 新功能上线', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 18:27:48', '2025-09-24 18:27:48');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (69, 'admin_login', '管理员登录成功', 2, 'admin', 3, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 20:33:53', '2025-09-24 20:33:53');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (70, 'order_ship', '订单发货成功：O202508260927310002', 2, NULL, 2, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 20:50:56', '2025-09-24 20:50:56');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (71, 'order_complete', '订单完成：O202508260927310002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 20:51:03', '2025-09-24 20:51:03');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (72, 'order_ship', '订单发货成功：O202508260926550001', 2, NULL, 2, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 22:18:29', '2025-09-24 22:18:29');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (73, 'order_complete', '订单完成：O202508260926550001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 22:18:38', '2025-09-24 22:18:38');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (74, 'order_create', '订单创建成功：O202509242310530001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 23:10:54', '2025-09-24 23:10:54');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (75, 'manual_fix', '手动修复订单O202509242310530001支付状态', 1, NULL, 4, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 23:19:12', '2025-09-24 23:19:12');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (76, 'order_create', '订单创建成功：O202509242320170001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-24 23:20:17', '2025-09-24 23:20:17');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (77, 'order_create', '订单创建成功：O202509250408230001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-25 04:08:23', '2025-09-25 04:08:23');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (78, 'order_cancel', '订单取消成功：O202509250408230001', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-25 04:14:02', '2025-09-25 04:14:02');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (79, 'order_create', '订单创建成功：O202509250414080002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-25 04:14:08', '2025-09-25 04:14:08');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (80, 'order_cancel', '订单取消成功：O202509250414080002', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-25 04:22:50', '2025-09-25 04:22:50');
INSERT INTO `system_logs` (`id`, `operation_type`, `operation_desc`, `operator_id`, `operator_name`, `operator_type`, `target_type`, `target_id`, `ip_address`, `user_agent`, `result`, `error_msg`, `created_at`, `updated_at`) VALUES (81, 'order_create', '订单创建成功：O202509250422570003', 1, NULL, 1, NULL, NULL, NULL, NULL, 1, NULL, '2025-09-25 04:22:57', '2025-09-25 04:22:57');
COMMIT;

-- ----------------------------
-- Table structure for user_addresses
-- ----------------------------
DROP TABLE IF EXISTS `user_addresses`;
CREATE TABLE `user_addresses` (
                                  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '地址ID',
                                  `user_id` bigint NOT NULL COMMENT '用户ID',
                                  `consignee` varchar(50) NOT NULL COMMENT '收件人',
                                  `phone` varchar(20) NOT NULL COMMENT '联系电话',
                                  `province` varchar(20) NOT NULL COMMENT '省份',
                                  `city` varchar(20) NOT NULL COMMENT '城市',
                                  `district` varchar(20) NOT NULL COMMENT '区县',
                                  `address` varchar(200) NOT NULL COMMENT '详细地址',
                                  `is_default` tinyint(1) DEFAULT '0' COMMENT '是否默认地址:0否,1是',
                                  `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                  PRIMARY KEY (`id`),
                                  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户收货地址表';

-- ----------------------------
-- Records of user_addresses
-- ----------------------------
BEGIN;
INSERT INTO `user_addresses` (`id`, `user_id`, `consignee`, `phone`, `province`, `city`, `district`, `address`, `is_default`, `created_at`, `updated_at`) VALUES (1, 1, '施琦大王', '17816786725', '广东省', '深圳市', '南山区', '政府大院2楼', 0, '2025-08-24 09:46:07', '2025-08-24 09:46:07');
COMMIT;

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
                         `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID',
                         `username` varchar(50) NOT NULL COMMENT '用户名',
                         `email` varchar(100) DEFAULT NULL COMMENT '邮箱',
                         `phone` varchar(20) NOT NULL COMMENT '手机号',
                         `password` varchar(128) NOT NULL COMMENT '密码(MD5加密)',
                         `nickname` varchar(50) DEFAULT NULL COMMENT '昵称',
                         `avatar` varchar(255) DEFAULT NULL COMMENT '头像',
                         `gender` tinyint(1) DEFAULT '0' COMMENT '性别:0未知,1男,2女',
                         `birthday` date DEFAULT NULL COMMENT '生日',
                         `real_name` varchar(50) DEFAULT NULL COMMENT '真实姓名',
                         `id_card` varchar(18) DEFAULT NULL COMMENT '身份证号',
                         `is_verified` tinyint(1) DEFAULT '0' COMMENT '是否实名认证:0否,1是',
                         `status` tinyint(1) DEFAULT '1' COMMENT '状态:0禁用,1正常',
                         `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
                         `created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                         `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                         PRIMARY KEY (`id`),
                         UNIQUE KEY `uk_username` (`username`),
                         UNIQUE KEY `uk_phone` (`phone`),
                         KEY `idx_email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户信息表';

-- ----------------------------
-- Records of users
-- ----------------------------
BEGIN;
INSERT INTO `users` (`id`, `username`, `email`, `phone`, `password`, `nickname`, `avatar`, `gender`, `birthday`, `real_name`, `id_card`, `is_verified`, `status`, `last_login_time`, `created_at`, `updated_at`) VALUES (1, 'qin', '852326703@qq.com', '13823680701', '$2a$10$/D/inxCXuf9Le73K0T.u2uYvvDe0iR1QknLGyDlZbiZr9EsOrBwSO', '嗷呜呜汪汪汪钦', NULL, 1, '2002-07-14', '狗王之王', NULL, 0, 1, '2025-09-25 03:49:41', '2025-07-16 09:30:09', '2025-08-24 17:54:07');
INSERT INTO `users` (`id`, `username`, `email`, `phone`, `password`, `nickname`, `avatar`, `gender`, `birthday`, `real_name`, `id_card`, `is_verified`, `status`, `last_login_time`, `created_at`, `updated_at`) VALUES (2, 'kim', '3399560459@qq.com', '13823680702', '$2a$10$ehcw4gToUJ9Nsa90I.zH4uY8isngL2mRK3b04eC4nql0rzlKKGbdy', NULL, NULL, 0, NULL, NULL, NULL, 0, 1, '2025-09-23 15:51:53', '2025-07-16 12:55:48', '2025-07-16 12:55:48');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
