/* Navicat Premium Dump SQL Source Server : localhost_3306 Source Server Type : MySQL Source Server Version : 80036 (8.0.36) Source Host : localhost:3306 Source Schema : flash_sale_db Target Server Type : MySQL Target Server Version : 80036 (8.0.36) File Encoding : 65001 Date: 09/05/2026 17:56:28 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for flash_sales -- ---------------------------- DROP TABLE IF EXISTS `flash_sales`; CREATE TABLE `flash_sales` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '秒杀活动ID', `product_id` bigint NOT NULL COMMENT '商品ID', `flash_price` decimal(10, 2) NOT NULL COMMENT '秒杀价格', `flash_stock` int NOT NULL COMMENT '秒杀库存', `start_time` timestamp NOT NULL COMMENT '开始时间', `end_time` timestamp NOT NULL COMMENT '结束时间', `status` tinyint DEFAULT '1' COMMENT '状态:1-未开始,2-进行中,3-已结束', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`), KEY `idx_product_id` (`product_id`), KEY `idx_start_time` (`start_time`), KEY `idx_end_time` (`end_time`), KEY `idx_status` (`status`), KEY `idx_created_at` (`created_at`), CONSTRAINT `flash_sales_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ) ENGINE = InnoDB AUTO_INCREMENT = 64 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT ='秒杀活动表'; -- ---------------------------- -- Records of flash_sales -- ---------------------------- BEGIN; INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (1, 1, 3.19, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (2, 2, 4.64, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (3, 3, 3.60, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (4, 4, 4.16, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (5, 5, 5.52, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (6, 6, 3.92, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (7, 7, 4.48, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (8, 8, 3.84, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (9, 9, 10.32, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (10, 10, 9.44, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (11, 11, 5.52, 80, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (12, 12, 10.88, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (13, 13, 15.92, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (14, 14, 19.92, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (15, 15, 23.04, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (16, 16, 26.32, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (17, 17, 15.12, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (18, 18, 17.44, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (19, 19, 11.12, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (20, 20, 18.24, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (21, 21, 13.44, 30, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (22, 22, 31.92, 30, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (23, 23, 15.04, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (24, 24, 10.32, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (25, 25, 39.92, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (26, 26, 62.40, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (27, 27, 20.72, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (28, 28, 47.92, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (29, 29, 10.24, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (30, 30, 13.52, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (31, 31, 5.52, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); INSERT INTO `flash_sales` (`id`, `product_id`, `flash_price`, `flash_stock`, `start_time`, `end_time`, `status`, `created_at`, `updated_at`) VALUES (32, 32, 7.92, 50, '2026-05-09 08:48:49', '2026-05-23 09:48:49', 2, '2026-05-09 09:48:49', '2026-05-09 09:48:49'); COMMIT; -- ---------------------------- -- Table structure for group_buying -- ---------------------------- DROP TABLE IF EXISTS `group_buying`; CREATE TABLE `group_buying` ( `id` bigint NOT NULL AUTO_INCREMENT, `created_at` datetime(6) NOT NULL, `duration_minutes` int NOT NULL, `end_time` datetime(6) NOT NULL, `group_price` decimal(10, 2) NOT NULL, `max_per_user` int NOT NULL, `product_id` bigint NOT NULL, `remaining_stock` int NOT NULL, `required_members` int NOT NULL, `start_time` datetime(6) NOT NULL, `status` int NOT NULL, `total_stock` int NOT NULL, `updated_at` datetime(6) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK59r61d7iyp2vxxkoyjudk343o` (`product_id`), CONSTRAINT `FK59r61d7iyp2vxxkoyjudk343o` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ) ENGINE = InnoDB AUTO_INCREMENT = 64 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of group_buying -- ---------------------------- BEGIN; INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (1, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 3.59, 2, 1, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (2, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 5.22, 2, 2, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (3, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 4.05, 2, 3, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (4, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 4.68, 2, 4, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (5, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 6.21, 2, 5, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (6, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 4.41, 2, 6, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (7, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 5.04, 2, 7, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (8, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 4.32, 2, 8, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (9, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 11.61, 2, 9, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (10, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 10.62, 2, 10, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (11, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 6.21, 2, 11, 100, 2, '2026-05-09 08:48:49.000000', 2, 100, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (12, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 12.24, 2, 12, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (13, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 17.91, 2, 13, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (14, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 22.41, 2, 14, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (15, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 25.92, 2, 15, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (16, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 29.61, 2, 16, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (17, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 17.01, 2, 17, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (18, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 19.62, 2, 18, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (19, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 12.51, 2, 19, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (20, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 20.52, 2, 20, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (21, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 15.12, 2, 21, 30, 3, '2026-05-09 08:48:49.000000', 2, 30, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (22, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 35.91, 2, 22, 30, 3, '2026-05-09 08:48:49.000000', 2, 30, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (23, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 16.92, 2, 23, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (24, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 11.61, 2, 24, 60, 3, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (25, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 44.91, 2, 25, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (26, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 70.20, 2, 26, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (27, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 23.31, 2, 27, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (28, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 53.91, 2, 28, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (29, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 11.52, 2, 29, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (30, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 15.21, 2, 30, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (31, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 6.21, 2, 31, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); INSERT INTO `group_buying` (`id`, `created_at`, `duration_minutes`, `end_time`, `group_price`, `max_per_user`, `product_id`, `remaining_stock`, `required_members`, `start_time`, `status`, `total_stock`, `updated_at`) VALUES (32, '2026-05-09 09:48:49.000000', 1440, '2026-05-23 09:48:49.000000', 8.91, 2, 32, 60, 2, '2026-05-09 08:48:49.000000', 2, 60, '2026-05-09 09:48:49.000000'); COMMIT; -- ---------------------------- -- Table structure for group_buying_group -- ---------------------------- DROP TABLE IF EXISTS `group_buying_group`; CREATE TABLE `group_buying_group` ( `id` bigint NOT NULL AUTO_INCREMENT, `completed_at` datetime(6) DEFAULT NULL, `created_at` datetime(6) NOT NULL, `current_members` int NOT NULL, `expire_time` datetime(6) NOT NULL, `group_buying_id` bigint NOT NULL, `group_no` varchar(64) NOT NULL, `leader_user_id` bigint NOT NULL, `required_members` int NOT NULL, `status` int NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_9khnmu1trewcuahx5k2m0am51` (`group_no`), KEY `FKqa4p2gmyfgv73i1278fncxyjd` (`group_buying_id`), KEY `FKmc231ojxg44fsobry8h71p7ts` (`leader_user_id`), CONSTRAINT `FKmc231ojxg44fsobry8h71p7ts` FOREIGN KEY (`leader_user_id`) REFERENCES `users` (`id`), CONSTRAINT `FKqa4p2gmyfgv73i1278fncxyjd` FOREIGN KEY (`group_buying_id`) REFERENCES `group_buying` (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of group_buying_group -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for group_buying_member -- ---------------------------- DROP TABLE IF EXISTS `group_buying_member`; CREATE TABLE `group_buying_member` ( `id` bigint NOT NULL AUTO_INCREMENT, `group_id` bigint NOT NULL, `joined_at` datetime(6) NOT NULL, `order_id` bigint DEFAULT NULL, `status` int NOT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `uk_group_user` (`group_id`, `user_id`), KEY `FK2k1d07r2qich4sqquxisdkf7e` (`user_id`), CONSTRAINT `FK2k1d07r2qich4sqquxisdkf7e` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`), CONSTRAINT `FKplwuuxax228wqw6nr6pnmmllq` FOREIGN KEY (`group_id`) REFERENCES `group_buying_group` (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of group_buying_member -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for notifications -- ---------------------------- DROP TABLE IF EXISTS `notifications`; CREATE TABLE `notifications` ( `id` bigint NOT NULL AUTO_INCREMENT, `created_at` datetime(6) NOT NULL, `link` varchar(255) DEFAULT NULL, `message` text NOT NULL, `is_read` bit(1) NOT NULL, `title` varchar(255) NOT NULL, `type` varchar(32) NOT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`id`), KEY `idx_notification_user_read` (`user_id`, `is_read`), KEY `idx_notification_user_created` (`user_id`, `created_at`) ) ENGINE = InnoDB AUTO_INCREMENT = 15 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- 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, `created_at` datetime(6) NOT NULL, `order_id` bigint NOT NULL, `price` decimal(10, 2) NOT NULL, `product_id` bigint NOT NULL, `product_image_url` varchar(500) DEFAULT NULL, `product_name` varchar(200) NOT NULL, `quantity` int NOT NULL, `subtotal` decimal(10, 2) NOT NULL, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of order_items -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for order_returns -- ---------------------------- DROP TABLE IF EXISTS `order_returns`; CREATE TABLE `order_returns` ( `id` bigint NOT NULL AUTO_INCREMENT, `admin_remark` varchar(500) DEFAULT NULL, `cancelled_at` datetime(6) DEFAULT NULL, `completed_at` datetime(6) DEFAULT NULL, `created_at` datetime(6) NOT NULL, `description` text, `images` varchar(2000) DEFAULT NULL, `order_id` bigint NOT NULL, `reason` varchar(500) NOT NULL, `refund_amount` decimal(10, 2) NOT NULL, `reject_reason` varchar(500) DEFAULT NULL, `return_no` varchar(64) NOT NULL, `return_tracking` varchar(100) DEFAULT NULL, `reviewed_at` datetime(6) DEFAULT NULL, `shipped_at` datetime(6) DEFAULT NULL, `status` int NOT NULL, `updated_at` datetime(6) DEFAULT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_elu6c1jupuay4bgn9gffdsbcx` (`return_no`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of order_returns -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for orders -- ---------------------------- DROP TABLE IF EXISTS `orders`; CREATE TABLE `orders` ( `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 '购买数量', `total_price` decimal(10, 2) NOT NULL COMMENT '总价', `status` tinyint DEFAULT '1' COMMENT '状态:1-待支付,2-已支付,3-已发货,4-已完成,5-已取消', `order_type` tinyint DEFAULT '1' COMMENT '订单类型:1-普通订单,2-秒杀订单', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `completed_at` datetime(6) DEFAULT NULL, `group_no` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `order_no` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL, `paid_at` datetime(6) DEFAULT NULL, `payment_method` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `receiver_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `receiver_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `receiver_phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `shipped_at` datetime(6) DEFAULT NULL, `flash_sale_id` bigint DEFAULT NULL, `group_buying_group_id` bigint DEFAULT NULL, PRIMARY KEY (`id`), KEY `idx_user_id` (`user_id`), KEY `idx_product_id` (`product_id`), KEY `idx_status` (`status`), KEY `idx_order_type` (`order_type`), KEY `idx_created_at` (`created_at`), KEY `idx_user_product` (`user_id`, `product_id`), CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE, CONSTRAINT `orders_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT ='订单表'; -- ---------------------------- -- Records of orders -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for product_reviews -- ---------------------------- DROP TABLE IF EXISTS `product_reviews`; CREATE TABLE `product_reviews` ( `id` bigint NOT NULL AUTO_INCREMENT, `admin_reply` text, `content` text NOT NULL, `created_at` datetime(6) NOT NULL, `order_id` bigint NOT NULL, `product_id` bigint NOT NULL, `rating` int NOT NULL, `replied_at` datetime(6) DEFAULT NULL, `status` int NOT NULL, `updated_at` datetime(6) DEFAULT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `uk_review_order_user_product` (`order_id`, `user_id`, `product_id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of product_reviews -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for products -- ---------------------------- DROP TABLE IF EXISTS `products`; CREATE TABLE `products` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '商品ID', `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品名称', `description` text COLLATE utf8mb4_unicode_ci COMMENT '商品描述', `price` decimal(10, 2) NOT NULL COMMENT '商品价格', `stock` int NOT NULL DEFAULT '0' COMMENT '库存数量', `image_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商品图片URL', `status` tinyint DEFAULT '1' COMMENT '状态:1-上架,0-下架', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `category` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `idx_name` (`name`), KEY `idx_price` (`price`), KEY `idx_stock` (`stock`), KEY `idx_status` (`status`), KEY `idx_created_at` (`created_at`) ) ENGINE = InnoDB AUTO_INCREMENT = 33 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT ='商品表'; -- ---------------------------- -- Records of products -- ---------------------------- BEGIN; INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (1, '本地小青菜 500g', '社区周边基地直采小青菜,叶片鲜嫩,适合清炒、煮汤。', 3.99, 300, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (2, '有机上海青 500g', '有机种植上海青,口感清甜,适合家庭日常烹饪。', 5.80, 220, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (3, '山东黄瓜 500g', '新鲜脆嫩黄瓜,可凉拌、清炒或制作沙拉。', 4.50, 260, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (4, '番茄 500g', '自然成熟番茄,酸甜适中,适合炒蛋、煮汤。', 5.20, 240, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (5, '西兰花 500g', '精选西兰花,花球紧实,适合清炒或水煮。', 6.90, 180, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (6, '土豆 1kg', '黄心土豆,口感绵密,适合炖煮、清炒。', 4.90, 350, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (7, '胡萝卜 1kg', '新鲜胡萝卜,色泽鲜亮,适合炖汤、炒菜。', 5.60, 280, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (8, '紫皮洋葱 1kg', '紫皮洋葱,辛香浓郁,适合炒菜、凉拌。', 4.80, 260, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '新鲜蔬菜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (9, '红富士苹果 1kg', '脆甜多汁红富士苹果,适合日常水果补充。', 12.90, 200, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '时令水果'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (10, '赣南脐橙 1kg', '当季脐橙,果肉饱满,汁水充足。', 11.80, 180, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '时令水果'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (11, '海南香蕉 1kg', '自然熟香蕉,香甜软糯,适合早餐和加餐。', 6.90, 240, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '时令水果'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (12, '库尔勒香梨 1kg', '果皮薄、口感脆甜,适合家庭分享。', 13.60, 160, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '时令水果'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (13, '精品草莓 500g', '当季新鲜草莓,果香浓郁,建议冷藏保存。', 19.90, 120, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '时令水果'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (14, '阳光玫瑰葡萄 500g', '精选阳光玫瑰葡萄,清甜爽口。', 24.90, 100, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '时令水果'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (15, '鲜鸡蛋 30枚', '农场直供鲜鸡蛋,蛋黄饱满,适合日常烹饪。', 28.80, 180, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '肉禽蛋品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (16, '土鸡蛋 20枚', '精选土鸡蛋,蛋香浓郁,适合蒸蛋、煎蛋。', 32.90, 120, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '肉禽蛋品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (17, '冷鲜猪五花肉 500g', '冷链配送五花肉,肥瘦相间,适合红烧。', 18.90, 160, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '肉禽蛋品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (18, '冷鲜猪里脊 500g', '肉质细嫩,适合炒肉丝、炸猪排。', 21.80, 140, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '肉禽蛋品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (19, '鸡胸肉 500g', '低脂鸡胸肉,适合健身餐、沙拉、煎制。', 13.90, 180, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '肉禽蛋品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (20, '琵琶腿 1kg', '冷鲜琵琶腿,肉质紧实,适合卤制、烤制。', 22.80, 150, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '肉禽蛋品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (21, '鲜活鲫鱼 500g', '鲜活鲫鱼,适合炖汤、红烧。', 16.80, 90, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '水产海鲜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (22, '基围虾 500g', '鲜活基围虾,肉质弹嫩,适合白灼、油焖。', 39.90, 80, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '水产海鲜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (23, '巴沙鱼柳 500g', '去刺巴沙鱼柳,适合煎制、水煮鱼片。', 18.80, 110, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '水产海鲜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (24, '花蛤 500g', '新鲜花蛤,适合爆炒、煮汤。', 12.90, 100, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '水产海鲜'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (25, '五常大米 5kg', '东北五常大米,米香浓郁,适合家庭主食。', 49.90, 130, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '米面粮油'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (26, '东北珍珠米 10kg', '颗粒饱满,口感软糯,适合日常家庭用米。', 78.00, 100, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '米面粮油'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (27, '高筋小麦粉 5kg', '适合制作馒头、面条、包子等面食。', 25.90, 150, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '米面粮油'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (28, '非转基因大豆油 5L', '家用桶装大豆油,适合煎炒烹炸。', 59.90, 120, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '米面粮油'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (29, '鲜牛奶 950ml', '低温鲜牛奶,口感醇厚,建议冷藏保存。', 12.80, 160, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '乳品饮品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (30, '原味酸奶 1kg', '家庭装原味酸奶,口感顺滑,适合早餐。', 16.90, 140, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '乳品饮品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (31, '豆浆 1L', '现磨风味豆浆,适合早餐搭配。', 6.90, 160, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '乳品饮品'); INSERT INTO `products` (`id`, `name`, `description`, `price`, `stock`, `image_url`, `status`, `created_at`, `updated_at`, `category`) VALUES (32, '鲜榨橙汁 300ml', '冷藏鲜榨橙汁,酸甜清爽。', 9.90, 100, NULL, 1, '2026-05-09 09:46:26', '2026-05-09 09:46:26', '乳品饮品'); COMMIT; -- ---------------------------- -- Table structure for user_addresses -- ---------------------------- DROP TABLE IF EXISTS `user_addresses`; CREATE TABLE `user_addresses` ( `id` bigint NOT NULL AUTO_INCREMENT, `address` varchar(255) NOT NULL, `city` varchar(50) DEFAULT NULL, `created_at` datetime(6) NOT NULL, `district` varchar(50) DEFAULT NULL, `is_default` bit(1) NOT NULL, `name` varchar(100) NOT NULL, `phone` varchar(20) NOT NULL, `province` varchar(50) DEFAULT NULL, `updated_at` datetime(6) DEFAULT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of user_addresses -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for user_favorites -- ---------------------------- DROP TABLE IF EXISTS `user_favorites`; CREATE TABLE `user_favorites` ( `id` bigint NOT NULL AUTO_INCREMENT, `created_at` datetime(6) NOT NULL, `product_id` bigint NOT NULL, `user_id` bigint NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `uk_favorite_user_product` (`user_id`, `product_id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci; -- ---------------------------- -- Records of user_favorites -- ---------------------------- BEGIN; COMMIT; -- ---------------------------- -- Table structure for users -- ---------------------------- DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '用户名', `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '密码(加密)', `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '邮箱', `phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号', `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '用户状态:1-正常,0-禁用', `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `last_login` datetime DEFAULT NULL COMMENT '最后登录时间', `avatar` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `role` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), KEY `idx_username` (`username`), KEY `idx_email` (`email`), KEY `idx_phone` (`phone`), KEY `idx_status` (`status`), KEY `idx_created_at` (`created_at`), KEY `idx_users_status` (`status`), KEY `idx_users_last_login` (`last_login`), KEY `idx_users_created_at` (`created_at`) ) ENGINE = InnoDB AUTO_INCREMENT = 16 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT ='用户表'; -- ---------------------------- -- Records of users -- ---------------------------- BEGIN; INSERT INTO `users` (`id`, `username`, `password`, `email`, `phone`, `status`, `created_at`, `updated_at`, `last_login`, `avatar`, `role`) VALUES (3, 'admin', '$2a$10$3V4zVguC/6eJjkuh78JqeufsNnjtHado/xUpGzrdLylF/TjH1ZoQ6', 'admin@example.com', '13800138000', 1, '2026-03-14 17:51:14', '2026-05-09 17:55:03', '2026-05-09 17:55:03', NULL, 'ADMIN'); COMMIT; -- ---------------------------- -- View structure for active_flash_sales -- ---------------------------- DROP VIEW IF EXISTS `active_flash_sales`; CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `active_flash_sales` AS select `fs`.`id` AS `id`, `fs`.`product_id` AS `product_id`, `p`.`name` AS `product_name`, `p`.`price` AS `original_price`, `fs`.`flash_price` AS `flash_price`, `fs`.`flash_stock` AS `flash_stock`, `fs`.`start_time` AS `start_time`, `fs`.`end_time` AS `end_time`, `fs`.`status` AS `status`, `p`.`image_url` AS `image_url` from (`flash_sales` `fs` join `products` `p` on ((`fs`.`product_id` = `p`.`id`))) where ((`fs`.`status` = 2) and (`fs`.`start_time` <= now()) and (`fs`.`end_time` > now()) and (`p`.`status` = 1)); -- ---------------------------- -- View structure for order_statistics -- ---------------------------- DROP VIEW IF EXISTS `order_statistics`; CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `order_statistics` AS select cast(`orders`.`created_at` as date) AS `order_date`, count(0) AS `total_orders`, sum((case when (`orders`.`status` = 1) then 1 else 0 end)) AS `pending_orders`, sum((case when (`orders`.`status` = 2) then 1 else 0 end)) AS `paid_orders`, sum((case when (`orders`.`status` = 4) then 1 else 0 end)) AS `completed_orders`, sum((case when (`orders`.`order_type` = 2) then 1 else 0 end)) AS `flash_sale_orders`, sum(`orders`.`total_price`) AS `total_amount` from `orders` group by cast(`orders`.`created_at` as date) order by `order_date` desc; SET FOREIGN_KEY_CHECKS = 1;