/*
 Navicat Premium Data Transfer

 Source Server         : 4dkk120.24.144.164
 Source Server Type    : MySQL
 Source Server Version : 80025
 Source Host           : 120.24.144.164:3306
 Source Schema         : 4dkankan_v4

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

 Date: 17/03/2025 15:53:32
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_product
-- ----------------------------
DROP TABLE IF EXISTS `t_product`;
CREATE TABLE `t_product`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `type_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '单价',
  `limit_count` int NULL DEFAULT NULL COMMENT '限购数量',
  `free_count` int NULL DEFAULT NULL COMMENT '免费数量',
  `rec_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'A',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of t_product
-- ----------------------------
INSERT INTO `t_product` VALUES (1, 'cooperation', '协作', 0.01, 5, 1, 'A', '2025-03-13 11:48:36', '2025-03-13 11:49:05');

-- ----------------------------
-- Table structure for t_product_cooperation
-- ----------------------------
DROP TABLE IF EXISTS `t_product_cooperation`;
CREATE TABLE `t_product_cooperation`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `order_sn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
  `cooperation_user_id` int NULL DEFAULT NULL,
  `rec_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'A',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of t_product_cooperation
-- ----------------------------

-- ----------------------------
-- Table structure for t_product_order
-- ----------------------------
CREATE TABLE `t_product_order` (
                                   `id` int NOT NULL AUTO_INCREMENT,
                                   `product_id` int DEFAULT NULL,
                                   `order_sn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '订单号',
                                   `amount` decimal(10,2) DEFAULT NULL,
                                   `number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '支付宝的交易号或者微信支付订单号',
                                   `pay_type` tinyint NOT NULL DEFAULT '-1' COMMENT '付款方式，0表示微信，1表示支付宝，2表示paypal，3表示其他',
                                   `pay_status` tinyint DEFAULT '0' COMMENT '状态，0或-1表示未付款，-2表示已退款,1表示已付款',
                                   `trade_time` datetime DEFAULT NULL COMMENT '交易时间',
                                   `user_id` bigint DEFAULT NULL COMMENT '用户表t_user的id',
                                   `count` tinyint DEFAULT NULL COMMENT '购买数量',
                                   `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
                                   `rec_status` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 'A' COMMENT '记录的状态，A: 生效，I: 禁用',
                                   `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
                                   `time_zone_off` int DEFAULT '0' COMMENT '时区差，单位分钟',
                                   `lang` varchar(255) DEFAULT NULL,
                                   `camera_id` int DEFAULT NULL,
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Records of t_product_order
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;

CREATE TABLE `t_scene_cooperation_count` (
                                             `id` int NOT NULL AUTO_INCREMENT,
                                             `num` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
                                             `count` int DEFAULT NULL,
                                             `rec_status` varchar(255) COLLATE utf8mb4_general_ci DEFAULT 'A',
                                             `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                                             `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                             PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;


ALTER TABLE `4dkankan_v4`.`t_scene_cooperation`
    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `rec_status`;

ALTER TABLE `4dkankan_v4`.`t_product_cooperation`
    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `update_time`,
    ADD COLUMN `need_pay` int NULL DEFAULT 0 AFTER `scene_type`;

ALTER TABLE `4dkankan_v4`.`t_product_order`
    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `update_time`,
    ADD COLUMN `need_pay` int NULL DEFAULT 0 AFTER `scene_type`;

ALTER TABLE `4dkankan_v4`.`t_scene_cooperation_count`
    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `rec_status`;