记得上下班打卡 | git大法好,push需谨慎

Commit b50a423f authored by 张国柄's avatar 张国柄

+SQl;

parent 08a9115d
...@@ -19,8 +19,126 @@ CREATE TABLE `kylin_order_coupons` ...@@ -19,8 +19,126 @@ CREATE TABLE `kylin_order_coupons`
`updated_at` datetime(3) NULL DEFAULT NULL COMMENT '修改时间', `updated_at` datetime(3) NULL DEFAULT NULL COMMENT '修改时间',
KEY `kylin_order_coupons_order_voucher_id_index` (`order_voucher_id`), KEY `kylin_order_coupons_order_voucher_id_index` (`order_voucher_id`),
KEY `kylin_order_coupons_order_id_index` (`order_id`), KEY `kylin_order_coupons_order_id_index` (`order_id`),
KEY `kylin_order_coupons_voucher_type_index` (`voucher_type`), KEY `kylin_order_coupons_voucher_type_index` (`coupon_type`),
PRIMARY KEY (`mid`) PRIMARY KEY (`mid`)
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET utf8mb4 DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT '订单券 关联表'; COLLATE utf8mb4_unicode_ci COMMENT '订单券 关联表';
# -- >>------------------------------------------------------------------------------------ |20210817会员与券改版
# 券发放管理
drop table if exists candy_mgt_coupon;
create table candy_mgt_coupon
(
mid bigint unsigned auto_increment primary key,
mcoupon_id varchar(64) not null,
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint comment '发放状态[0-未发放|1-已发放|2-无效|9-发放中]',
bind_type smallint comment '领取方式[0-用户输入兑换|1-发放至用户]',
event_amt int comment '发放量',
event_type tinyint comment '发放类型[10-全体用户|1-会员|2-手机号]',
event_limit text comment '`发放类型`为2-手机号时发放手机号以,分隔',
event_at datetime(3) comment '发放时间(立即-当前时间+3分钟|预约-点选时间)',
operator varchar(64) not null comment '操作人',
created_at datetime(3) not null,
updated_at datetime(3),
comment text
) engine InnoDB comment '券发放管理';
create unique index uidx_candy_mgt_coupon_id on candy_mgt_coupon (mcoupon_id);
# 券基础信息
drop table if exists candy_coupon;
create table candy_coupon
(
mid bigint unsigned auto_increment primary key,
coupon_id varchar(64) not null,
state tinyint default 0 comment '券状态[0-INIT|1-NORMAL|2-INVALID]',
title varchar(50) not null comment '券标题',
label varchar(50) comment '标注',
notice varchar(200) comment '注意/须知',
exclusive smallint comment '专享标识[0-常规|1-会员礼包]',
busi_type smallint comment '业务类别[0-全场|1-演出|2-商品|3-优先购|4-会员]',
cou_type smallint comment '券类型[1-代金券|2-满减券|3-兑换券|4-折扣券]',
bind_type smallint comment '领取方式[0-用户输入兑换|1-发放至用户]',
discount decimal(8, 2) comment '折扣[8折即0.8]',
val_face decimal(8, 2) comment '面值',
val_over decimal(8, 2) comment '满减~满',
val_minus decimal(8, 2) comment '满减~减',
overlay tinyint default 0 comment '叠加限制[0-限制|1-叠加]',
overlay_level tinyint default 0 comment '#同类别券叠加适用',
validity int comment '有效期(单位天)',
redeem_validity int comment '兑换有效期(单位天)',
redeem_start datetime(3) comment '兑换开放时间',
redeem_stop datetime(3) comment '兑换停止时间',
effect_at datetime(3) comment '生效时间',
expire_at datetime(3) comment '过期时间',
comment varchar(255)
) engine = InnoDB comment '券基础信息';
create unique index uidx_candy_coupon_id on candy_coupon (coupon_id);
# 券适用规则
drop table if exists candy_coupon_rule;
create table candy_coupon_rule
(
mid bigint unsigned auto_increment primary key,
crule_id varchar(64) not null,
coupon_id varchar(64) not null,
use_scope smallint comment '适用范围[100-全场|90-演出|80-商品]',
busi_name varchar(64) comment '适用名称',
busi_id varchar(64) comment '适用ID',
state tinyint comment '0-INIT,1-NORMAL,2-INVALID',
comment varchar(255)
) engine = InnoDB comment '券适用规则';
create unique index uidx_candy_coupon_rule_id on candy_coupon_rule (crule_id);
# 券码信息
drop table if exists candy_coupon_code;
create table candy_coupon_code
(
mid bigint unsigned auto_increment primary key,
ccode_id varchar(64) not null comment '兑换码',
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint comment '状态[0-未使用|1-已使用|2-失效|3-退回]',
target_uid varchar(64) comment '目标用户UID',
redeem_uid varchar(64) comment '兑换用户UID',
created_at datetime(3) not null,
updated_at datetime(3),
redeem_at datetime(3) comment '兑换时间',
comment varchar(255)
) engine = InnoDB comment '券码信息';
create unique index uidx_candy_coupon_code_id on candy_coupon_code (ccode_id);
# 用户券信息
drop table if exists candy_user_coupon;
create table candy_user_coupon
(
mid bigint unsigned auto_increment primary key,
ucoupon_id varchar(64) not null,
mcoupon_id varchar(64) not null comment '~candy_mgt_coupon.mcoupon_id',
uid varchar(64) not null comment '~adam_user.uid',
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint default 0 comment '券状态[0-待兑换|1-可用|2-无效|3-已使用]',
bind_at datetime(3) comment '入账时间',
redeem_code varchar(64) comment '兑换码',
redeem_at datetime(3) comment '兑换时间',
used_at datetime(3) comment '使用时间',
used_for varchar(255) comment '用于记录购买的内容',
comment varchar(255)
) engine = InnoDB comment '用户券信息';
create unique index uidx_candy_user_coupon_id on candy_user_coupon (ucoupon_id);
-- >>------------------------------------------------------------------------------------
\ No newline at end of file
...@@ -339,6 +339,71 @@ create table adam_member_order_ext ...@@ -339,6 +339,71 @@ create table adam_member_order_ext
) engine = InnoDB comment '用户会员订单扩展信息表'; ) engine = InnoDB comment '用户会员订单扩展信息表';
create unique index uidx_amember_order_ext_id on adam_member_order_ext (order_no); create unique index uidx_amember_order_ext_id on adam_member_order_ext (order_no);
-- >>------------------------------------------------------------------------------------ |20210817会员与券改版
# 添加限购逻辑,新增限购开始、结束时间字段
alter table adam_member add limit_start datetime(3) null comment '限购开始时间' after limitation;
alter table adam_member add limit_end datetime(3) null comment '限购结束时间' after limit_start;
# 添加`是否开售`开关,新增开售开关字段
alter table adam_member add onsale tinyint default 0 null comment '是否开售:1-开售|2-停售' after limit_end;
# 添加`双倍积分`开关
alter table adam_member add integral_rate decimal(8, 6) default 0 null comment '积分倍率X100' after state;
# 添加会员价格字段
alter table adam_member_price modify price_fixed decimal(8, 2) null comment '购买价格';
alter table adam_member_price add price_special decimal(8, 2) null comment '特价:首次、首年优惠价' after price_fixed;
# 订单
alter table adam_member_order modify state tinyint null comment '订单状态:0-未支付,1-已支付,2-已关闭,3-超时付,4-退款中,5-已退款';
alter table adam_member_order modify pay_no varchar(64) null comment '支付中心支付CODE';
alter table adam_member_order add payment_id varchar(64) null comment '支付中心三方支付®ID' after pay_no;
# 会员退款
drop table if exists adam_member_refund;
create table adam_member_refund
(
mid bigint unsigned auto_increment primary key,
refund_no varchar(64) comment '退款请求编号',
order_no varchar(64) not null comment '对应支付中心order_code',
refund_price decimal(8, 2) comment '退款金额',
refund_reason varchar(200) comment '退款描述',
renewable tinyint comment '继续购买[1-可以|2-不可]',
refund_state tinyint comment '退款状态[0-发起退款|1-已退款|2-取消退款|3-退款失败|9-退款中]',
# payment_type varchar(30) comment '支付渠道(即UPPER(CONCAT(device_from,pay_type)))',
repay_no varchar(64) comment '支付中心退款编号',
repay_reason varchar(200) comment '支付中心退款描述',
operator varchar(64) comment '操作人',
created_at datetime(3) not null,
updated_at datetime(3),
complete_at datetime(3) comment '完成时间',
comment varchar(255)
) engine = InnoDB comment '会员退款';
create unique index uidx_adam_member_refund_id on adam_member_refund (order_no);
# 添加权益管理(关联会员券)
drop table if exists adam_member_rights;
create table adam_member_rights
(
mid bigint unsigned auto_increment primary key,
mrights_id varchar(64) not null,
state tinyint comment '发放状态[0-INIT|1-NORMAL|2-INVALID]',
title varchar(50) not null comment '权益标题',
sub_title varchar(255) comment '副标题',
label varchar(50) comment '标注',
icon varchar(255) comment '图片标识',
detail text comment '详情内容',
comment varchar(255)
) engine = InnoDB comment '会员权益配置';
create unique index uidx_adam_member_rights_id on adam_member_rights (mrights_id);
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------ -- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------ -- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------ -- >>------------------------------------------------------------------------------------
# create database if not exists ln_scene character set utf8mb4 collate utf8mb4_unicode_ci;
# use ln_scene;
# -- >>------------------------------------------------------------------------------------ |20210817会员与券改版
# 券发放管理
drop table if exists candy_mgt_coupon;
create table candy_mgt_coupon
(
mid bigint unsigned auto_increment primary key,
mcoupon_id varchar(64) not null,
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint comment '发放状态[0-未发放|1-已发放|2-无效|9-发放中]',
bind_type smallint comment '领取方式[0-用户输入兑换|1-发放至用户]',
event_amt int comment '发放量',
event_type tinyint comment '发放类型[10-全体用户|1-会员|2-手机号]',
event_limit text comment '`发放类型`为2-手机号时发放手机号以,分隔',
event_at datetime(3) comment '发放时间(立即-当前时间+3分钟|预约-点选时间)',
operator varchar(64) not null comment '操作人',
created_at datetime(3) not null,
updated_at datetime(3),
comment text
) engine InnoDB comment '券发放管理';
create unique index uidx_candy_mgt_coupon_id on candy_mgt_coupon (mcoupon_id);
# 券基础信息
drop table if exists candy_coupon;
create table candy_coupon
(
mid bigint unsigned auto_increment primary key,
coupon_id varchar(64) not null,
state tinyint default 0 comment '券状态[0-INIT|1-NORMAL|2-INVALID]',
title varchar(50) not null comment '券标题',
label varchar(50) comment '标注',
notice varchar(200) comment '注意/须知',
exclusive smallint comment '专享标识[0-常规|1-会员礼包]',
busi_type smallint comment '业务类别[0-全场|1-演出|2-商品|3-优先购|4-会员]',
cou_type smallint comment '券类型[1-代金券|2-满减券|3-兑换券|4-折扣券]',
bind_type smallint comment '领取方式[0-用户输入兑换|1-发放至用户]',
discount decimal(8, 2) comment '折扣[8折即0.8]',
val_face decimal(8, 2) comment '面值',
val_over decimal(8, 2) comment '满减~满',
val_minus decimal(8, 2) comment '满减~减',
overlay tinyint default 0 comment '叠加限制[0-限制|1-叠加]',
overlay_level tinyint default 0 comment '#同类别券叠加适用',
validity int comment '有效期(单位天)',
redeem_validity int comment '兑换有效期(单位天)',
redeem_start datetime(3) comment '兑换开放时间',
redeem_stop datetime(3) comment '兑换停止时间',
effect_at datetime(3) comment '生效时间',
expire_at datetime(3) comment '过期时间',
comment varchar(255)
) engine = InnoDB comment '券基础信息';
create unique index uidx_candy_coupon_id on candy_coupon (coupon_id);
# 券适用规则
drop table if exists candy_coupon_rule;
create table candy_coupon_rule
(
mid bigint unsigned auto_increment primary key,
crule_id varchar(64) not null,
coupon_id varchar(64) not null,
use_scope smallint comment '适用范围[100-全场|90-演出|80-商品]',
busi_name varchar(64) comment '适用名称',
busi_id varchar(64) comment '适用ID',
state tinyint comment '0-INIT,1-NORMAL,2-INVALID',
comment varchar(255)
) engine = InnoDB comment '券适用规则';
create unique index uidx_candy_coupon_rule_id on candy_coupon_rule (crule_id);
# 券码信息
drop table if exists candy_coupon_code;
create table candy_coupon_code
(
mid bigint unsigned auto_increment primary key,
ccode_id varchar(64) not null comment '兑换码',
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint comment '状态[0-未使用|1-已使用|2-失效|3-退回]',
target_uid varchar(64) comment '目标用户UID',
redeem_uid varchar(64) comment '兑换用户UID',
created_at datetime(3) not null,
updated_at datetime(3),
redeem_at datetime(3) comment '兑换时间',
comment varchar(255)
) engine = InnoDB comment '券码信息';
create unique index uidx_candy_coupon_code_id on candy_coupon_code (ccode_id);
# 用户券信息
drop table if exists candy_user_coupon;
create table candy_user_coupon
(
mid bigint unsigned auto_increment primary key,
ucoupon_id varchar(64) not null,
mcoupon_id varchar(64) not null comment '~candy_mgt_coupon.mcoupon_id',
uid varchar(64) not null comment '~adam_user.uid',
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint default 0 comment '券状态[0-待兑换|1-可用|2-无效|3-已使用]',
bind_at datetime(3) comment '入账时间',
redeem_code varchar(64) comment '兑换码',
redeem_at datetime(3) comment '兑换时间',
used_at datetime(3) comment '使用时间',
used_for varchar(255) comment '用于记录购买的内容',
comment varchar(255)
) engine = InnoDB comment '用户券信息';
create unique index uidx_candy_user_coupon_id on candy_user_coupon (ucoupon_id);
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment