SET
FOREIGN_KEY_CHECKS=0;

DROP TABLE IF EXISTS `yshop_bury_point`;
CREATE TABLE `yshop_bury_point`
(
    `id`              bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `user_id`         bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
    `event`           varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事件',
    `event_parameter` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '事件参数',
    `creator`         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`     datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`     datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`         bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `ip`              varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IP',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '埋点表' ROW_FORMAT = Dynamic;


DROP TABLE IF EXISTS `yshop_campaign_detail`;
CREATE TABLE `yshop_campaign_detail`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '营销活动明细id',
    `campaign_id` bigint(20) NOT NULL COMMENT '营销活动id',
    `product_id`  bigint(20) NOT NULL COMMENT '商品id',
    `sku_id`      bigint(20) NOT NULL COMMENT '规格id',
    `price`       decimal(15, 2) NOT NULL COMMENT '活动价格',
    `discount`    decimal(4, 2) NULL DEFAULT NULL COMMENT '折扣比例',
    `stock`       int(11) NOT NULL COMMENT '活动库存剩余数量',
    `total`       int(11) NOT NULL COMMENT '活动库存总数量',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`     bit(1)         NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `tenant_id`   bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '营销活动明细表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_campaign_info`;
CREATE TABLE `yshop_campaign_info`
(
    `id`             bigint(20) NOT NULL AUTO_INCREMENT COMMENT '营销活动id',
    `name`           varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动名称',
    `type`           tinyint(4) NOT NULL COMMENT '活动类型：1、拼团，2、秒杀，3、限时折扣',
    `remark`         varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
    `start_time`     varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动开始时间',
    `end_time`       varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '活动结束时间',
    `if_limit`       tinyint(1) NOT NULL COMMENT '商品限购 1-不限购 2-限购',
    `limit_number`   int(11) NULL DEFAULT NULL COMMENT '限购几件/人',
    `if_enable`      tinyint(1) NOT NULL COMMENT '活动预热   1-停用  2-启用',
    `enable_time`    int(11) NULL DEFAULT NULL COMMENT '预热几分钟前',
    `state`          tinyint(1) NULL DEFAULT NULL COMMENT '活动状态 0-未开始 1-进行中 2-已结束',
    `person`         int(11) NULL DEFAULT NULL COMMENT '成团人数',
    `effective_time` int(11) NULL DEFAULT NULL COMMENT '成团有效时间几（分钟）',
    `creator`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`    datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`    datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`        bit(1)                                                 NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `tenant_id`      bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
    `is_virtually`   tinyint(1) NULL DEFAULT 0 COMMENT '是否虚拟成团:0-否，1-是',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '活动信息表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_canvas`;
CREATE TABLE `yshop_canvas`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '画布id',
    `name`        varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称',
    `state`       tinyint(1) NULL DEFAULT NULL COMMENT '状态 0-关闭 1-开启',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime                                                NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime                                                NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`     bit(1)                                                  NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `tenant_id`   bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
    `type`        tinyint(1) NOT NULL COMMENT '画布类型 1-首页 2-我的',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '画布信息表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_canvas_detail`;
CREATE TABLE `yshop_canvas_detail`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '画布明细id',
    `canvas_id`   bigint(20) NOT NULL COMMENT '画布id',
    `terminal`    tinyint(1) NOT NULL COMMENT '终端 1-小程序 2-H5 3-APP',
    `json`        longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '画布json数据',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`     bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `tenant_id`   bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '画布明细表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_customer_service`;
CREATE TABLE `yshop_customer_service`
(
    `id`          bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '订单ID',
    `open_kfid`   varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信客服ID',
    `shop_id`     varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商家ID(停用)',
    `creator`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
    `create_time` datetime NOT NULL COMMENT '添加时间',
    `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `updater`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者',
    `deleted`     bit(1) NULL DEFAULT b'0' COMMENT '逻辑删除',
    `name`        varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客服名称',
    `avatar`      varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '客服头像',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客服管理' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor`;
CREATE TABLE `yshop_distributor`
(
    `id`                 bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `user_id`            bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
    `real_name`          varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '真实姓名',
    `level_id`           bigint(20) NULL DEFAULT NULL COMMENT '等级ID',
    `superior_id_p1`     bigint(20) NULL DEFAULT NULL COMMENT '所属一级ID',
    `superior_name_p1`   varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级名称',
    `superior_id_p2`     bigint(20) NULL DEFAULT NULL COMMENT '所属二级ID',
    `superior_name_p2`   varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级名称',
    `address`            varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
    `reason`             varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '申请原因',
    `refuse`             varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拒绝原因',
    `status`             int(11) NULL DEFAULT NULL COMMENT '状态-1-清退 0-待审核 1-已通过 2-已拒绝',
    `add_up_amount`      decimal(10, 2) NULL DEFAULT 0.00 COMMENT '累计金额',
    `add_up_wages`       decimal(10, 2) NULL DEFAULT 0.00 COMMENT '累计佣金',
    `add_up_distributor` int(11) NULL DEFAULT 0 COMMENT '累计下级经销商',
    `creator`            varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`        datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`            varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`        datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`            bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor_dynamics`;
CREATE TABLE `yshop_distributor_dynamics`
(
    `id`               bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `type`             int(11) NULL DEFAULT NULL COMMENT '动态类型',
    `distributor_id`   bigint(20) NULL DEFAULT NULL COMMENT '分销商ID',
    `distributor_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分销商名称',
    `content`          varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '内容',
    `creator`          varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`      datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`          varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`      datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`          bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商动态表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor_level`;
CREATE TABLE `yshop_distributor_level`
(
    `id`           bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `level`        int(11) NULL DEFAULT NULL COMMENT '等级 1-10',
    `name`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '等级名称',
    `first_wages`  int(11) NULL DEFAULT NULL COMMENT '一级佣金比例',
    `second_wages` int(11) NULL DEFAULT NULL COMMENT '二级佣金比例',
    `up_type`      int(11) NULL DEFAULT NULL COMMENT '升级类型 0-满足任意 1-满足全部',
    `user_count`   int(11) NULL DEFAULT NULL COMMENT '人数 值为-1是未选中',
    `amount`       bigint(11) NULL DEFAULT NULL COMMENT '金额 值为-1是未选中',
    `wages`        bigint(11) NULL DEFAULT NULL COMMENT '佣金 值为-1是未选中',
    `creator`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`      bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商等级表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor_order`;
CREATE TABLE `yshop_distributor_order`
(
    `id`                              bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `oid`                             bigint(20) NULL DEFAULT NULL COMMENT '订单ID',
    `order_id`                        varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '订单号',
    `detail_id`                       bigint(32) NULL DEFAULT NULL COMMENT '订单详情id',
    `user_id`                         bigint(20) NULL DEFAULT NULL COMMENT '下单用户',
    `user_name`                       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户昵称',
    `product_id`                      bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '商品ID',
    `product_attr_value_id`           bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '商品规格ID',
    `product_price`                   decimal(12, 2) NULL DEFAULT 0.00 COMMENT '商品金额',
    `status`                          int(11) NULL DEFAULT NULL COMMENT '佣金状态',
    `settlement_time`                 datetime NULL DEFAULT NULL COMMENT '结算时间',
    `distribution_rule`               tinyint(1) NULL DEFAULT 0 COMMENT '分销规则 0-默认 1-自定义',
    `distribution_purchase`           tinyint(1) NULL DEFAULT 0 COMMENT '分销自购 0-关闭 1-开启',
    `distribution_product_settlement` tinyint(1) NULL DEFAULT 0 COMMENT '商品结算方式 0-实际支付价格 1-商品价格',
    `distribution_wages_settlement`   tinyint(1) NULL DEFAULT 0 COMMENT '佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算',
    `distribution_level`              tinyint(1) NULL DEFAULT 0 COMMENT '分销规则 1-一级 2-二级',
    `product_name`                    varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名称',
    `superior_id_p1`                  bigint(20) NULL DEFAULT NULL COMMENT '所属一级ID',
    `superior_name_p1`                varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级名称',
    `superior_id_p2`                  bigint(20) NULL DEFAULT NULL COMMENT '所属二级ID',
    `superior_name_p2`                varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级名称',
    `first_wages`                     int(11) NULL DEFAULT NULL COMMENT '一级佣金比例',
    `second_wages`                    int(11) NULL DEFAULT NULL COMMENT '二级佣金比例',
    `first_amount`                    decimal(10, 2) NULL DEFAULT NULL COMMENT '一级佣金',
    `second_amount`                   decimal(10, 2) NULL DEFAULT NULL COMMENT '二级佣金',
    `creator`                         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`                     datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`                         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`                     datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`                         bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `product_original_price`          decimal(12, 2) NULL DEFAULT 0.00 COMMENT '商品原价',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商订单表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor_user`;
CREATE TABLE `yshop_distributor_user`
(
    `id`               bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `user_id`          bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
    `nickname`         varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户昵称',
    `avatar`           varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户头像',
    `superior_id_p1`   bigint(20) NULL DEFAULT NULL COMMENT '所属一级ID',
    `superior_name_p1` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级名称',
    `superior_id_p2`   bigint(20) NULL DEFAULT NULL COMMENT '所属二级ID',
    `superior_name_p2` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上级名称',
    `product_count`    int(11) UNSIGNED ZEROFILL NULL DEFAULT NULL COMMENT '商品数',
    `order_count`      int(11) UNSIGNED ZEROFILL NULL DEFAULT NULL COMMENT '订单数',
    `wages`            decimal(12, 2) UNSIGNED ZEROFILL NULL DEFAULT NULL COMMENT '佣金数',
    `creator`          varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`      datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`          varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`      datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`          bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `expire_time`      datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '过期时间',
    `is_distributor`   int(11) NULL DEFAULT 0 COMMENT '是否分销商 0-否 1-是',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商所属用户表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor_wages`;
CREATE TABLE `yshop_distributor_wages`
(
    `id`             bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `user_id`        bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
    `creator`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`    datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`    datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`        bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `amount`         decimal(10, 2) NULL DEFAULT NULL COMMENT '佣金',
    `refuse_amount`  decimal(10, 2) NULL DEFAULT NULL COMMENT '待入账佣金',
    `distributor_id` bigint(20) NULL DEFAULT NULL COMMENT '分销商ID',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商佣金表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor_wages_log`;
CREATE TABLE `yshop_distributor_wages_log`
(
    `id`                   bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `wages_id`             bigint(20) NULL DEFAULT NULL COMMENT '佣金ID',
    `user_id`              bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
    `user_name`            varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '用户昵称',
    `distributor_id`       bigint(20) NULL DEFAULT NULL COMMENT '分销商ID',
    `distributor_name`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分销商名称',
    `type`                 int(11) NULL DEFAULT NULL COMMENT '佣金类型',
    `status`               int(11) NULL DEFAULT NULL COMMENT '记录状态',
    `amount`               decimal(10, 2) NULL DEFAULT NULL COMMENT '佣金金额',
    `method_type`          int(11) NULL DEFAULT NULL COMMENT '提取类型',
    `creator`              varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`          datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`              varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`          datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`              bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `distributor_order_id` bigint(20) NULL DEFAULT NULL COMMENT '分销商订单ID',
    `order_id`             varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '订单号',
    `content`              varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '说明',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商佣金记录表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_distributor_withdrawal_method`;
CREATE TABLE `yshop_distributor_withdrawal_method`
(
    `id`             bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    `user_id`        bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
    `distributor_id` bigint(20) NULL DEFAULT NULL COMMENT '分销商ID',
    `payment_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '支付方式',
    `account_num`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '账号',
    `real_name`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '真实姓名',
    `creator`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `type`           int(2) NULL DEFAULT NULL COMMENT '类型',
    `create_time`    datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`    datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`        bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分销商提现方式表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_integral_rule`;
CREATE TABLE `yshop_integral_rule`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '评论ID',
    `type`        varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类型',
    `type_name`   varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型名称',
    `integral`    int(100) NULL DEFAULT NULL COMMENT '获取积分',
    `attribute1`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拓展字段',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime                                                     NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime                                                     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`     bit(1)                                                       NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `icon_url`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标',
    `enable`      bit(1) NULL DEFAULT b'1' COMMENT '是否开启',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员积分规则' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_material_bak`;
CREATE TABLE `yshop_material_bak`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
    `create_time` datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `creator`     varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
    `type`        char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin      NOT NULL COMMENT '类型1、图片；2、视频',
    `group_id`    varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '分组ID',
    `name`        varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '素材名',
    `url`         varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '素材链接',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新者',
    `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `deleted`     bit(1)                                                 NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '素材库' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `yshop_material_group_bak`;
CREATE TABLE `yshop_material_group_bak`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
    `create_time` datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `creator`     varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
    `name`        varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '分组名',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新者',
    `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
    `deleted`     bit(1)                                                 NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '素材分组' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `yshop_popup`;
CREATE TABLE `yshop_popup`
(
    `id`           bigint(20) NOT NULL AUTO_INCREMENT COMMENT '弹窗id',
    `name`         varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '名称',
    `start_time`   varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci  NOT NULL COMMENT '开始时间',
    `end_time`     varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci  NOT NULL COMMENT '结束时间',
    `popup_image`  text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '弹窗图',
    `button_image` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '按钮图',
    `type`         tinyint(4) NOT NULL COMMENT '跳转类型：0、不跳转，1、商品，2、分类，3、优惠券，4、小程序',
    `link`         text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '链接',
    `state`        tinyint(1) NULL DEFAULT NULL COMMENT '状态 0-关闭 1-开启',
    `creator`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`  datetime                                                NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`  datetime                                                NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`      bit(1)                                                  NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `tenant_id`    bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '弹窗表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_recharge_config`;
CREATE TABLE `yshop_recharge_config`
(
    `id`            bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `custom_switch` int(11) NULL DEFAULT NULL COMMENT '自定义金额开关 0-关闭 1-开启',
    `custom_min`    int(11) NULL DEFAULT NULL COMMENT '最小金额',
    `content`       text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '说明',
    `creator`       varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`   datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`       varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`   datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`       bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '充值配置' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `yshop_recharge_order`;
CREATE TABLE `yshop_recharge_order`
(
    `id`              varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '订单ID',
    `user_id`         bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '用户id',
    `status`          int(11) NULL DEFAULT NULL COMMENT '充值状态 0-未支付 1-已支付',
    `creator`         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`     datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`     datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`         bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
    `recharge_amount` int(11) NULL DEFAULT NULL COMMENT '充值金额',
    `gift_amount`     int(11) NULL DEFAULT NULL COMMENT '赠送金额',
    `package_id`      bigint(20) NULL DEFAULT NULL COMMENT '充值套餐ID',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '充值订单表' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `yshop_recharge_package`;
CREATE TABLE `yshop_recharge_package`
(
    `id`              bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单ID',
    `recharge_amount` int(11) NULL DEFAULT NULL COMMENT '充值金额',
    `gift_amount`     int(11) NULL DEFAULT NULL COMMENT '赠送金额',
    `status`          int(11) NULL DEFAULT NULL COMMENT '状态 1-开启 0-关闭',
    `creator`         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`     datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`         varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`     datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`         bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '充值套餐配置' ROW_FORMAT = DYNAMIC;

DROP TABLE IF EXISTS `yshop_shop`;
CREATE TABLE `yshop_shop`
(
    `id`                   bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
    `store_name`           varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '门店名称',
    `store_intro`          varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '门店简介',
    `store_phone`          varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '门店手机',
    `icon_url`             varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '门店logo',
    `address`              varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci  NOT NULL COMMENT '门店地址',
    `lon`                  double                                                         NOT NULL COMMENT '精度',
    `lat`                  double                                                         NOT NULL COMMENT '纬度',
    `write_off_start_time` datetime NULL DEFAULT NULL COMMENT '核销开始时间',
    `write_off_end_time`   datetime NULL DEFAULT NULL COMMENT '核销结束时间',
    `business_start_time`  time                                                           NOT NULL COMMENT '营业开始时间',
    `business_end_time`    time                                                           NOT NULL COMMENT '营业结束时间',
    `status`               bit(1)                                                         NOT NULL DEFAULT b'1' COMMENT '状态',
    `creator`              varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`          datetime                                                       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`              varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`          datetime                                                       NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`              bit(1)                                                         NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门店' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_shop_assistant`;
CREATE TABLE `yshop_shop_assistant`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
    `store_id`    bigint(20) NOT NULL COMMENT '门店ID',
    `user_id`     bigint(20) NULL DEFAULT NULL COMMENT '会员ID',
    `name`        varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名',
    `phone_no`    varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
    `status`      bit(1)   NOT NULL DEFAULT b'1' COMMENT '状态',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`     bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门店店员' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_sign_in_record`;
CREATE TABLE `yshop_sign_in_record`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
    `user_id`     bigint(20) NULL DEFAULT NULL COMMENT '会员ID',
    `integral`    decimal(10, 0) NULL DEFAULT NULL COMMENT '积分',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`     bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '签到记录' ROW_FORMAT = Dynamic;


ALTER TABLE `yshop_store_after_sales`
    ADD COLUMN `refund_integral` decimal(10, 0) NULL DEFAULT NULL AFTER `receiving_status`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `campaign_detail_id` bigint(20) NULL DEFAULT NULL COMMENT '营销活动明细id' AFTER `city_id`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `campaign_type` tinyint(4) NULL DEFAULT NULL COMMENT '活动类型：1、拼团，2、秒杀，3、限时折扣' AFTER `campaign_detail_id`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `write_off_status` tinyint(4) NULL DEFAULT 0 COMMENT '核销状态' AFTER `campaign_type`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `write_off_date` datetime NULL DEFAULT NULL COMMENT '核销时间' AFTER `write_off_status`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `teamwork_id` bigint(20) NULL DEFAULT NULL COMMENT '拼团id' AFTER `write_off_date`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `write_off_code` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '核销码' AFTER `teamwork_id`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `is_after_sales` tinyint(4) NULL DEFAULT 1 COMMENT '是否能售后0不能1能' AFTER `write_off_code`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `distributor_id` bigint(20) NULL DEFAULT NULL COMMENT '分销商id' AFTER `is_after_sales`;

ALTER TABLE `yshop_store_order`
    ADD COLUMN `total_coupon_price` decimal(8, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '总优惠金额' AFTER `distributor_id`;

ALTER TABLE `yshop_store_order` MODIFY COLUMN `real_name` varchar (32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户姓名' AFTER `uid`;

ALTER TABLE `yshop_store_order` MODIFY COLUMN `user_phone` varchar (18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户电话' AFTER `real_name`;

ALTER TABLE `yshop_store_order` MODIFY COLUMN `user_address` varchar (100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '详细地址' AFTER `user_phone`;

ALTER TABLE `yshop_store_order` MODIFY COLUMN `store_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '门店id' AFTER `verify_code`;


ALTER TABLE `yshop_store_order_cart_info`
    ADD COLUMN `integral_deduction_amount` decimal(8, 2) NULL DEFAULT 0.00 COMMENT '积分抵扣金额' AFTER `postage_price`;

ALTER TABLE `yshop_store_order_cart_info`
    ADD COLUMN `use_integral` decimal(8, 2) NULL DEFAULT 0.00 COMMENT '使用积分' AFTER `integral_deduction_amount`;

ALTER TABLE `yshop_store_order_cart_info`
    ADD COLUMN `pay_price` decimal(8, 2) NULL DEFAULT 0.00 COMMENT '实际支付金额' AFTER `use_integral`;

DROP TABLE IF EXISTS `yshop_store_order_detail`;
CREATE TABLE `yshop_store_order_detail`
(
    `id`                        bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单明细id',
    `oid`                       bigint(20) NOT NULL COMMENT '订单id',
    `product_id`                bigint(20) NOT NULL COMMENT '商品ID',
    `sku_id`                    bigint(20) NULL DEFAULT NULL COMMENT '规格id',
    `product_attr_unique`       varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '唯一id',
    `original_price`            decimal(15, 2)                                         NOT NULL COMMENT '原价',
    `price`                     decimal(15, 2)                                         NOT NULL COMMENT '实际价格',
    `state`                     tinyint(1) NULL DEFAULT 1 COMMENT '状态：1、正常，2、售后中，3、售后完成',
    `creator`                   varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`               datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`                   varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`               datetime                                               NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`                   bit(1)                                                 NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `tenant_id`                 bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
    `order_id`                  varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '订单号',
    `after_sales_id`            bigint(20) NULL DEFAULT NULL COMMENT '售后id',
    `integral_deduction_amount` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '积分抵扣金额',
    `use_integral`              decimal(10, 2) NULL DEFAULT 0.00 COMMENT '使用积分',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单明细表' ROW_FORMAT = DYNAMIC;

ALTER TABLE `yshop_store_product`
    ADD COLUMN `is_distribution` int(1) NULL DEFAULT 0 COMMENT '是否分销 0-否 1-是' AFTER `tenant_id`;

ALTER TABLE `yshop_store_product`
    ADD COLUMN `distribution_rule` int(1) NULL DEFAULT 0 COMMENT '分销规则 0-默认 1-自定义' AFTER `is_distribution`;

ALTER TABLE `yshop_store_product`
    ADD COLUMN `distribution_purchase` int(1) NULL DEFAULT 0 COMMENT '分销自购 0-关闭 1-开启' AFTER `distribution_rule`;

ALTER TABLE `yshop_store_product`
    ADD COLUMN `distribution_product_settlement` int(1) NULL DEFAULT 0 COMMENT '商品结算方式 0-实际支付价格 1-商品价格' AFTER `distribution_purchase`;

ALTER TABLE `yshop_store_product`
    ADD COLUMN `distribution_wages_settlement` int(1) NULL DEFAULT 2 COMMENT '佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算' AFTER `distribution_product_settlement`;

ALTER TABLE `yshop_store_product`
    ADD COLUMN `distribution_level` int(1) NULL DEFAULT 2 COMMENT '分销规则 1-一级 2-二级' AFTER `distribution_wages_settlement`;

ALTER TABLE `yshop_store_product_attr_value`
    ADD COLUMN `first_wages` int(11) NULL DEFAULT 0 COMMENT '一级佣金比例' AFTER `integral`;

ALTER TABLE `yshop_store_product_attr_value`
    ADD COLUMN `second_wages` int(11) NULL DEFAULT 0 COMMENT '二级佣金比例' AFTER `first_wages`;

DROP TABLE IF EXISTS `yshop_teamwork_info`;
CREATE TABLE `yshop_teamwork_info`
(
    `id`                      bigint(20) NOT NULL AUTO_INCREMENT COMMENT '拼团id',
    `campaign_id`             bigint(20) NOT NULL COMMENT '拼团活动id',
    `people`                  int(11) NOT NULL COMMENT '参团人数',
    `state`                   tinyint(1) NOT NULL COMMENT '成团状态 0-拼团中 1-拼团成功 2-拼团失败',
    `creator`                 varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`             datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`                 varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`             datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`                 bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `tenant_id`               bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
    `regimental_commander_id` bigint(20) NOT NULL COMMENT '团长id',
    `campaign_detail_id`      bigint(20) NOT NULL COMMENT '营销活动明细id',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '拼团信息表' ROW_FORMAT = Dynamic;

ALTER TABLE `yshop_user`
    ADD COLUMN `open_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公众号openid' AFTER `tenant_id`;

ALTER TABLE `yshop_user`
    ADD COLUMN `routine_open_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '小程序openid' AFTER `open_id`;

ALTER TABLE `yshop_user`
    ADD COLUMN `growth_value` int(11) NULL DEFAULT 0 COMMENT '会员等级成长值' AFTER `sex`;

ALTER TABLE `yshop_user`
    ADD COLUMN `write_off_authority` bit(1) NULL DEFAULT b'0' COMMENT '核销权限' AFTER `growth_value`;

ALTER TABLE `yshop_user`
    ADD COLUMN `invitation_code` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邀请码' AFTER `write_off_authority`;

ALTER TABLE `yshop_user` MODIFY COLUMN `level` bigint(20) NOT NULL DEFAULT 0 COMMENT '等级' AFTER `status`;

ALTER TABLE `yshop_user` DROP COLUMN `openid`;

ALTER TABLE `yshop_user` DROP COLUMN `routine_openid`;

DROP TABLE IF EXISTS `yshop_user_invite_log`;
CREATE TABLE `yshop_user_invite_log`
(
    `id`                bigint(20) NOT NULL AUTO_INCREMENT COMMENT '评论ID',
    `user_id`           bigint(20) NOT NULL COMMENT '邀请用户id',
    `be_invite_user_id` bigint(20) NOT NULL COMMENT '被邀请用户id',
    `creator`           varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`       datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`           varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`       datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`           bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '邀请日志' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_user_level_config`;
CREATE TABLE `yshop_user_level_config`
(
    `id`             bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
    `level_name`     varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '等级名称',
    `level`          int(11) NOT NULL COMMENT '等级',
    `growth_value`   int(11) NOT NULL COMMENT '成长值',
    `icon_url`       varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标',
    `background_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '背景',
    `status`         bit(1) NULL DEFAULT b'1' COMMENT '状态',
    `remarks`        varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '说明',
    `creator`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`    datetime                                                      NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`    datetime                                                      NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`        bit(1)                                                        NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `color_num`      varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '色号',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级配置' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_user_level_equity`;
CREATE TABLE `yshop_user_level_equity`
(
    `id`          bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
    `type`        varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权益类型',
    `type_name`   varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型名称',
    `creator`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`     varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`     bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `icon_url`    varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标',
    `remarks`     varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '说明',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级权益配置' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_user_level_equity_ref`;
CREATE TABLE `yshop_user_level_equity_ref`
(
    `id`           bigint(20) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
    `level_id`     bigint(20) NOT NULL COMMENT '等级ID',
    `equity_id`    bigint(20) NOT NULL COMMENT '权益ID',
    `creator`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`      bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `equity_value` bigint(20) NULL DEFAULT NULL COMMENT '权益值',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级权益中间表' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_user_level_growth_value_config`;
CREATE TABLE `yshop_user_level_growth_value_config`
(
    `id`           int(11) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
    `type`         varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '成长任务类型',
    `type_name`    varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型名称',
    `growth_value` int(11) NULL DEFAULT NULL COMMENT '成长值',
    `creator`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
    `create_time`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updater`      varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
    `update_time`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    `deleted`      bit(1)   NOT NULL DEFAULT b'0' COMMENT '是否删除',
    `icon_url`     varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员成长任务配置' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_user_tag`;
CREATE TABLE `yshop_user_tag`
(
    `id`          bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户id',
    `tag_name`    varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称',
    `group_id`    bigint(20) NULL DEFAULT NULL COMMENT '分组ID',
    `creator`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
    `create_time` datetime NULL DEFAULT NULL COMMENT '添加时间',
    `updater`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者',
    `update_time` datetime NULL DEFAULT NULL COMMENT '最后一次登录时间',
    `deleted`     bit(1) NULL DEFAULT b'0' COMMENT '删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员标签' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_user_tag_group`;
CREATE TABLE `yshop_user_tag_group`
(
    `id`          bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户id',
    `group_name`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分组名称',
    `sorted`      int(10) NULL DEFAULT 0 COMMENT '排序',
    `creator`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
    `create_time` datetime NULL DEFAULT NULL COMMENT '添加时间',
    `updater`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者',
    `update_time` datetime NULL DEFAULT NULL COMMENT '最后一次登录时间',
    `deleted`     bit(1) NULL DEFAULT b'0' COMMENT '删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员标签分组' ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `yshop_user_tag_ref`;
CREATE TABLE `yshop_user_tag_ref`
(
    `id`          bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `user_id`     bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
    `tag_id`      bigint(20) NULL DEFAULT NULL COMMENT '标签ID',
    `creator`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建者',
    `create_time` datetime NULL DEFAULT NULL COMMENT '添加时间',
    `updater`     varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新者',
    `update_time` datetime NULL DEFAULT NULL COMMENT '最后一次登录时间',
    `deleted`     bit(1) NULL DEFAULT b'0' COMMENT '删除',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户标签中间表' ROW_FORMAT = Dynamic;

INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1239, 1, '未开始', '0', 'activity_status', 0, '', '', '', '1', '2024-01-18 16:38:46', '1',
        '2024-01-18 16:38:46', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1240, 2, '进行中', '1', 'activity_status', 0, '', '', '', '1', '2024-01-18 16:38:59', '1',
        '2024-01-18 16:38:59', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1241, 2, '已结束', '2', 'activity_status', 0, '', '', '', '1', '2024-01-18 16:39:11', '1',
        '2024-01-18 16:39:11', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1242, 3, '预热中', '3', 'activity_status', 0, '', '', '', '1', '2024-01-18 16:39:21', '1',
        '2024-01-18 16:39:21', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1243, 0, '客户保护天数', '-1', 'distributor_user_expire', 0, '', '', '', '1', '2024-01-18 20:49:39', '1',
        '2024-02-02 14:58:40', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1244, 0, '自购返佣开关', '1', 'distributor_purchase', 0, '', '', '自购返佣开关 0-关闭 1-开启', '1',
        '2024-01-18 20:51:53', '1', '2024-02-02 14:58:40', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1245, 0, '自动审核开关', '1', 'distributor_apply', 0, '', '', '0-关闭 1-开启', '1', '2024-01-18 20:53:14', '1',
        '2024-02-02 14:58:40', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1246, 0, '分销商协议', '<p>东北哥我是你爹11</p>', 'distributor_agreement', 0, '', '', '', '1',
        '2024-01-18 20:53:56', '1', '2024-02-02 14:58:40', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1247, 1, '拼团中', '0', 'group_status', 0, '', '', '', '1', '2024-01-21 15:52:49', '1', '2024-01-21 15:52:49',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1248, 2, '拼团成功', '1', 'group_status', 0, '', '', '', '1', '2024-01-21 15:53:03', '1', '2024-01-21 15:53:03',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1249, 3, '拼团失败', '2', 'group_status', 0, '', '', '', '1', '2024-01-21 15:53:20', '1', '2024-01-21 15:53:20',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1250, 1, '待审核', '0', 'distributor_status', 0, '', '', '', '1', '2024-01-25 14:37:08', '1',
        '2024-01-25 14:37:08', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1251, 2, '已通过', '1', 'distributor_status', 0, '', '', '', '1', '2024-01-25 14:37:21', '1',
        '2024-01-25 14:37:21', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1252, 3, '已拒绝', '2', 'distributor_status', 0, '', '', '', '1', '2024-01-25 14:37:42', '1',
        '2024-01-25 14:37:42', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1253, 4, '已清退', '-1', 'distributor_status', 0, '', '', '', '1', '2024-01-25 14:38:02', '1',
        '2024-01-25 14:40:56', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1254, 1, '待入账', '0', 'entryStatus', 0, '', '', '', '1', '2024-01-25 20:14:17', '1', '2024-01-25 20:14:17',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1255, 2, '已入账', '1', 'entryStatus', 0, '', '', '', '1', '2024-01-25 20:14:28', '1', '2024-01-25 20:14:28',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1256, 3, '已取消', '2', 'entryStatus', 0, '', '', '', '1', '2024-01-25 20:14:36', '1', '2024-01-25 20:14:36',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1257, 4, '提现中', '3', 'entryStatus', 0, '', '', '', '1', '2024-01-25 20:14:51', '1', '2024-01-25 20:14:51',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1258, 5, '提现成功', '4', 'entryStatus', 0, '', '', '', '1', '2024-01-25 20:15:11', '1', '2024-01-25 20:15:11',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1259, 6, '提现失败', '5', 'entryStatus', 0, '', '', '', '1', '2024-01-25 20:15:25', '1', '2024-01-25 20:15:25',
        b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1260, 1, '待结算', '0', 'commission_status', 0, '', '', '', '1', '2024-01-26 11:31:29', '1',
        '2024-01-26 11:31:29', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1261, 2, '已结算', '1', 'commission_status', 0, '', '', '', '1', '2024-01-26 11:31:39', '1',
        '2024-01-26 11:31:39', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1262, 3, '已取消', '2', 'commission_status', 0, '', '', '', '1', '2024-01-26 11:31:52', '1',
        '2024-01-26 11:31:52', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1263, 1, 'integral_name', '积分', 'integral_config', 0, '', '', '积分名称', '1', '2024-01-26 14:40:29', '1',
        '2024-01-26 14:40:29', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1264, 2, 'integral_enable', '1', 'integral_config', 0, '', '', '积分抵扣是否开启 0关闭 1开启', '1',
        '2024-01-26 14:41:10', '1', '2024-02-02 11:40:02', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1265, 3, 'integral_deduction_rule', '10', 'integral_config', 0, '', '', '积分抵扣规则 xx积分抵扣1元', '1',
        '2024-01-26 14:41:53', '1', '2024-02-04 22:05:25', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1266, 1, 'close_after_sale_days', '1', 'close_after_sale_days', 0, '', '', '关闭售后天数', '1',
        '2024-01-26 16:07:18', '1', '2024-01-26 16:11:56', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1267, 1, '客户保护期', '1', 'distributor_user_expire', 0, '', '', '客户保护期 永久为-1 其它为天数大于0', '1',
        '2024-01-28 19:03:08', '1', '2024-01-29 19:57:43', b'1');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1268, 2, '自购返佣', '0', 'distribution_config', 0, '', '', '自购返佣0关闭 1开启', '1', '2024-01-28 19:49:52',
        '1', '2024-01-28 20:27:49', b'1');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1269, 3, '分销商审核', '2', 'distribution_config', 0, '', '', '分销商审核0关闭 1开启', '1',
        '2024-01-28 19:53:37', '1', '2024-01-28 20:27:47', b'1');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`,
                                `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (1270, 4, '分销协议', '协议', 'distribution_config', 0, '', '', '分销协议富文本', '1', '2024-01-28 19:55:08',
        '1', '2024-01-28 20:27:45', b'1');

INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (174, '营销活动状态', 'activity_status', 0, '营销活动状态', '1', '2024-01-18 16:37:46', '1',
        '2024-01-18 16:37:46', b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (175, '客户保护期', 'distributor_user_type', 0, '', '1', '2024-01-18 19:48:31', '1', '2024-01-18 19:49:10', b'1',
        '2024-01-18 19:49:11');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (176, '分销商配置', 'distributor', 0, '', '1', '2024-01-18 19:49:28', '1', '2024-01-18 20:48:36', b'1',
        '2024-01-18 20:48:37');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (177, '分销商用户保护期', 'distributor_user_expire', 0, '保护期', '1', '2024-01-18 20:49:13', '1',
        '2024-01-29 20:10:13', b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (178, '分销商自购开关', 'distributor_purchase', 0, '', '1', '2024-01-18 20:51:24', '1', '2024-01-18 20:52:22',
        b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (179, '分销商审核开关', 'distributor_apply', 0, '', '1', '2024-01-18 20:52:51', '1', '2024-01-18 20:52:51', b'0',
        '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (180, '分销商协议', 'distributor_agreement', 0, '', '1', '2024-01-18 20:53:41', '1', '2024-01-18 20:53:41', b'0',
        '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (181, '拼团状态', 'group_status', 0, '拼团状态\n', '1', '2024-01-21 15:51:13', '1', '2024-01-21 15:51:20', b'0',
        '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (182, '分销商状态', 'distributor_status', 0, '分销商状态', '1', '2024-01-25 14:36:36', '1',
        '2024-01-25 14:36:36', b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (183, '入账状态', 'entryStatus', 0, '入账状态', '1', '2024-01-25 20:13:34', '1', '2024-01-25 20:13:34', b'0',
        '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (184, '佣金状态', 'commission_status', 0, '佣金状态', '1', '2024-01-26 11:28:44', '1', '2024-01-26 11:28:44',
        b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (185, '积分配置', 'integral_config', 0, '', '1', '2024-01-26 14:39:49', '1', '2024-01-26 14:39:49', b'0',
        '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (186, '关闭售后天数', 'close_after_sale_days', 0, '', '1', '2024-01-26 16:06:33', '1', '2024-01-26 16:06:33',
        b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`,
                                `update_time`, `deleted`, `deleted_time`)
VALUES (187, '分销配置', 'distribution_config', 0, '分销配置', '1', '2024-01-28 18:58:50', '1', '2024-01-28 20:28:20',
        b'1', '2024-01-28 20:28:21');

SET
FOREIGN_KEY_CHECKS=1;