/*
 Navicat Premium Data Transfer

 Source Server         : group_buy_local
 Source Server Type    : MySQL
 Source Server Version : 80042
 Source Host           : localhost:13306
 Source Schema         : pay-mall

 Target Server Type    : MySQL
 Target Server Version : 80042
 File Encoding         : 65001

 Date: 16/07/2025 17:08:44
*/
-- 如果存在就删除
DROP DATABASE IF EXISTS `pay-mall`;

-- 创建（如需指定字符集与排序规则，可自行调整）
CREATE DATABASE IF NOT EXISTS `group_buying_sys`
  DEFAULT CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

-- 切换到该库
USE `pay-mall`;

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for pay_order
-- ----------------------------
DROP TABLE IF EXISTS `pay_order`;
CREATE TABLE `pay_order`  (
                              `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
                              `user_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '用户ID',
                              `product_id` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品ID',
                              `product_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '商品名称',
                              `order_id` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单ID',
                              `order_time` datetime NOT NULL COMMENT '下单时间',
                              `total_amount` decimal(8, 2) UNSIGNED NULL DEFAULT NULL COMMENT '订单金额',
                              `status` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '订单状态；create-创建完成、pay_wait-等待支付、pay_success-支付成功、deal_done-交易完成、close-订单关单',
                              `pay_url` varchar(2014) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '支付信息',
                              `pay_time` datetime NULL DEFAULT NULL COMMENT '支付时间',
                              `market_type` tinyint(1) NULL DEFAULT NULL COMMENT '营销类型；0无营销、1拼团营销',
                              `market_deduction_amount` decimal(8, 2) NULL DEFAULT NULL COMMENT '营销金额；优惠金额',
                              `pay_amount` decimal(8, 2) NOT NULL COMMENT '支付金额',
                              `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                              `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                              PRIMARY KEY (`id`) USING BTREE,
                              UNIQUE INDEX `uq_order_id`(`order_id` ASC) USING BTREE,
                              INDEX `idx_user_id_product_id`(`user_id` ASC, `product_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 35 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of pay_order
-- ----------------------------
INSERT INTO `pay_order` VALUES (36, 'opEtBvq6go0co-HQC5DSHkKfkdds', '9890001', 'MyBatisBook', '498873906342', '2025-07-16 15:53:11', 100.00, 'DEAL_DONE', '<form name=\"punchout_form\" method=\"post\" action=\"https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=YHURFlD5GRayv1bHAezkCE0W%2BJbS5l4pxwR2eH9k6SLfes2DozLEVvgo3H28mMNTRw1EK6lc%2FN56HUvBOTD4DNtpQ72d3S4v51v%2FqV1%2FxPHIC9HDAQD%2FTTTln6ZjRzLSkWQxRn7aQOBiVhTplu7B%2BBkPKIpIEwWsKtlI0GSCM7%2BE9dQdKrv9BYLD9eAGIJNhL%2FRC3Fu1CkbvhyMPmCxkjkH1vrbx5tmeeWXfOaMkXmR3vePVE9f4xcZgKHiYcBPdaSO%2Brs4uzskw9idRwUzL1xX%2BZElA2hZGCtgXCYz40MVsWiPiwT0voUQcbFE48ZfobOAzKtmpfgILFF2p3qLoFQ%3D%3D&return_url=https%3A%2F%2Fblog.bitday.top&notify_url=https%3A%2F%2Fpay.bitday.top%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000150645052&sign_type=RSA2&timestamp=2025-07-16+15%3A53%3A11&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;498873906342&quot;,&quot;total_amount&quot;:80.00,&quot;subject&quot;:&quot;MyBatisBook&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>', '2025-07-16 15:54:03', 1, 20.00, 80.00, '2025-07-16 15:53:11', '2025-07-16 16:44:47');
INSERT INTO `pay_order` VALUES (39, 'smile01', '9890001', 'MyBatisBook', '369511405849', '2025-07-16 16:28:58', 100.00, 'PAY_SUCCESS', '<form name=\"punchout_form\" method=\"post\" action=\"https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=O11ikCcaT503aUwewmNj71Y6PZ5IsqAQ3vqrJK3bCahFJe9KmWbAYMkO91%2FGrCmkmekZ%2Bl2wL85OS4IPNlAMRKmtOhRC22VyqHFjhFaLCr5zzQjvoWgFWMOiAt33x8cdeLvi1RW7nQ66ll1SEi33syInH154TO3MrqTMmLGIPdMvXDmz%2FyfmSQ5h6ZQdN9aaSdFSTR8q%2BFgcvGMSVJSTAog%2BJbMHwsRxZXqlFI8LX8%2Fsh7fRoM87l8Ws1jAKRm6BS6sRgbfmEOdtJRO95Uc2LYLVT817%2B3Fvll2B8KwkSa66Ar2Oo6s6emCQJl3IG67TcA5%2FdPhtyYFtFsqSbpAqQw%3D%3D&return_url=https%3A%2F%2Fblog.bitday.top&notify_url=https%3A%2F%2Fpay.bitday.top%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000150645052&sign_type=RSA2&timestamp=2025-07-16+16%3A28%3A59&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;369511405849&quot;,&quot;total_amount&quot;:80.00,&quot;subject&quot;:&quot;MyBatisBook&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>', '2025-07-16 16:30:33', 1, 20.00, 80.00, '2025-07-16 16:28:57', '2025-07-16 16:30:33');
INSERT INTO `pay_order` VALUES (40, 'smile01', '9890001', 'MyBatisBook', '698481154046', '2025-07-16 16:34:25', 100.00, 'DEAL_DONE', '<form name=\"punchout_form\" method=\"post\" action=\"https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=nCszW8W%2F%2Fyhu7x9uPcJJmKv8gYoayqFmqLojw8Q%2BDt2bI5OqBKyoZhT61rdexukp%2BLtvZcWOxJ8sDN%2Bf4Zq8FUvb7uxCsWaD7HWTlgm5KXdSc%2BEVawudxr8aWd16ZRI69WDCGiAvKCgTkX20me2%2Bnv2sdHBd2p7G%2FdkhMtVpMPQHxu4a%2BCQ%2Fatlb2JU1qT1GK0SGglQjtQQpb9mNJIIS5NTf2rGF5%2BIB%2BGWU%2Fj0tGl5ney6ZhxuEnRJzIbrgz6riYOsvhguntMIZxws1%2F8ZakrGE2MYsjesahI8v6eaNAJij2jjkLqX40jrleFwLGMZvidRPgOnpr4z3q5n%2FEFo5dQ%3D%3D&return_url=https%3A%2F%2Fblog.bitday.top&notify_url=https%3A%2F%2Fpay.bitday.top%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000150645052&sign_type=RSA2&timestamp=2025-07-16+16%3A34%3A25&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;698481154046&quot;,&quot;total_amount&quot;:100.00,&quot;subject&quot;:&quot;MyBatisBook&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>', '2025-07-16 16:35:36', 0, 0.00, 100.00, '2025-07-16 16:34:24', '2025-07-16 16:35:36');
INSERT INTO `pay_order` VALUES (41, 'smile02', '9890001', 'MyBatisBook', '541129857040', '2025-07-16 16:36:49', 100.00, 'DEAL_DONE', '<form name=\"punchout_form\" method=\"post\" action=\"https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=Ot5z8oK7xO7jmA2pzCnVkE32AdUjurl9YPuSgNwtWjI433Ki5ZAuvhxFfW2V6N20JQPYiGA%2FFYwlgPZ2V53DfeYEDwTZ9yXyJ9ZL74J6kUWGsotnp53JUQZkTTTMT6uBIsl2r2lt5YeLo3GvOkTdxBqxpow%2F%2F8ZxvY6xi9IIN5DGQ8inhwNR8p3rAJS82PKHKFHImNeYg51pUPtU0cqJzrXeN4bT0EincERBhT7j6pcvvRjrPDX9VgSRdwtp5duQC2I9PabqihLVXhAMwhafcKkSRPrYVlJmUgedtYw2Z7Y74CTjgMdYuEKznRsEGvabqUCP2nQ2lWssVTsmJ35cJQ%3D%3D&return_url=https%3A%2F%2Fblog.bitday.top&notify_url=https%3A%2F%2Fpay.bitday.top%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000150645052&sign_type=RSA2&timestamp=2025-07-16+16%3A36%3A49&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;541129857040&quot;,&quot;total_amount&quot;:80.00,&quot;subject&quot;:&quot;MyBatisBook&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>', '2025-07-16 16:38:05', 1, 20.00, 80.00, '2025-07-16 16:36:49', '2025-07-16 16:44:47');
INSERT INTO `pay_order` VALUES (42, 'smile04', '9890001', 'MyBatisBook', '381698719384', '2025-07-16 16:43:47', 100.00, 'DEAL_DONE', '<form name=\"punchout_form\" method=\"post\" action=\"https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=MN1%2F2PVMYwkEB4VE3SKphhG95QQUGlMeOwN5PwfNd1C4rdGo4PWJpBor5G3FfuHknCcugcwwQ09zhAljDG6ZxggkzwPvkh04zv5eWuWfIXXIl%2Bzj5onXv6rVvElzL1BFUJ8UxpdgjNNFVWQJVLndHA0WuAB4ZQ0W9c4Jew%2FMd1Gd3p7HzESC16Wcy1zMxg%2FSUPSjORA9Cmf2jrT1RqDAy2Sj%2FNZriEByMlX0rIz44LFCciDLBVo3JzYmshOoU%2FtDwSLn3Ob9WMlLRaKmae8X4bSzCesYbEvEmlN9jl9Mc3MN4hJ0RZ8%2FpC%2B9xk6%2FNKNW1VROTzg801iLhxUK0vAc0g%3D%3D&return_url=https%3A%2F%2Fblog.bitday.top&notify_url=https%3A%2F%2Fpay.bitday.top%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000150645052&sign_type=RSA2&timestamp=2025-07-16+16%3A43%3A47&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;381698719384&quot;,&quot;total_amount&quot;:80.00,&quot;subject&quot;:&quot;MyBatisBook&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>', '2025-07-16 16:44:47', 1, 20.00, 80.00, '2025-07-16 16:43:46', '2025-07-16 16:44:47');
INSERT INTO `pay_order` VALUES (45, 'smile04', '9890001', 'MyBatisBook', '380924838419', '2025-07-16 16:54:06', 100.00, 'DEAL_DONE', '<form name=\"punchout_form\" method=\"post\" action=\"https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=utf-8&method=alipay.trade.page.pay&sign=SsZLFKzuRwKy%2BfH71Qr%2BhpHFi1zoDdb11O7Exl08xstV628NGoRTBzUeLiZqJWAmlCo6CA4y%2F5SLVdE1shz%2FOPYRJfvRvxIkBbn8qfH79bJyMcd3BIt3ETPPMJSHDZ9mWU1HEAhP4n5rsKBRZHG0mjo%2BxQdoApF6pAwqXBXK6xs9McrV9c%2BC77vMlQ7yMTY6LT9uYmNsFoxekbXYXswMLmiEBX2F%2BNXw77RUKhA0jlMuM1xEydy5LrNaukXgrnS9wLORosTNDRvZnvf4TIk4ln1IYFDYz2WMfLO658bXdvVDW2huxWCqn6Br9VX3I6hj6AXSnSVd7HswstXZACiieQ%3D%3D&return_url=https%3A%2F%2Fblog.bitday.top&notify_url=https%3A%2F%2Fpay.bitday.top%2Fapi%2Fv1%2Falipay%2Falipay_notify_url&version=1.0&app_id=9021000150645052&sign_type=RSA2&timestamp=2025-07-16+16%3A54%3A05&alipay_sdk=alipay-sdk-java-4.38.157.ALL&format=json\">\n<input type=\"hidden\" name=\"biz_content\" value=\"{&quot;out_trade_no&quot;:&quot;380924838419&quot;,&quot;total_amount&quot;:100.00,&quot;subject&quot;:&quot;MyBatisBook&quot;,&quot;product_code&quot;:&quot;FAST_INSTANT_TRADE_PAY&quot;}\">\n<input type=\"submit\" value=\"立即支付\" style=\"display:none\" >\n</form>\n<script>document.forms[0].submit();</script>', '2025-07-16 16:55:14', 0, 0.00, 100.00, '2025-07-16 16:54:05', '2025-07-16 16:55:14');

SET FOREIGN_KEY_CHECKS = 1;
