Bladeren bron

新增 优惠券及会员优惠券 表初始化脚本

lijun 2 jaren geleden
bovenliggende
commit
60f8fe3497
1 gewijzigde bestanden met toevoegingen van 37 en 0 verwijderingen
  1. 37 0
      doc/sql/update/bt-2301-2月份需求.sql

+ 37 - 0
doc/sql/update/bt-2301-2月份需求.sql

@@ -7,3 +7,40 @@ ALTER TABLE zuihou_base_bt_0000.bt_place ADD region_id BIGINT(20) NULL COMMENT '
 
 -- 新增 简介 字段
 ALTER TABLE zuihou_base_bt_0000.bt_goods ADD introduction varchar(200) NULL COMMENT '简介';
+
+-- 新增 优惠券 表,承载优惠券数据
+create table bt_coupon
+(
+   id                   bigint(20) not null  comment '主键',
+   name                 varchar(100) not null  comment '优惠券名称',
+   preferential_amount  decimal(20,2) not null  comment '优惠金额',
+   quantity             int not null  comment '数量',
+   preferential_method  char(1) not null  comment '优惠方式: 0 -> 按月累计消费, 1 -> 历史消费累计',
+   accumulated_amount   decimal(20,2) not null  comment '累计金额',
+   end_date             datetime not null  comment '优惠结束时间',
+   status               char(1) not null  comment '状态: 0 -> 冻结(结束) 1 -> 启用(进行中),默认为冻结',
+   remark               text  comment '说明',
+   create_time          datetime not null  comment '创建时间',
+   create_user          bigint(20) not null  comment '创建人',
+   update_time          datetime not null  comment '修改时间',
+   update_user          bigint(20) not null  comment '修改人',
+   delete_flag          char(1) not null  comment '删除标识: 0 -> 未删除, 1 -> 删除,落库是默认为0',
+   primary key (id)
+);
+
+alter table bt_coupon comment '优惠券';
+
+-- 新增 会员优惠券 表,承载会员领券记录
+create table bt_member_coupon
+(
+   id                   bigint(20) not null  comment '',
+   member_id            bigint(20) not null  comment '会员ID,关联bt_member表主键',
+   coupon_id            bigint(20) not null  comment '优惠券ID,关联bt_coupon表主键',
+   receive_preferential_amount decimal(20,2) not null  comment '领券优惠金额:对应优惠券领取时的即时金额,使用时,以即时金额为基准,确保对应优惠券的优惠金额变更时领券金额不受更新影响',
+   status               char(1) not null  comment '使用状态: 0 -> 未使用, 1 -> 已使用',
+   create_time          datetime not null  comment '创建时间',
+   update_time          datetime not null  comment '修改时间',
+   primary key (id)
+);
+
+alter table bt_member_coupon comment '会员优惠券';