part1
CREATE TABLE merchant_warehouse_rule(
id INT NOT NULL AUTO_INCREMENT COMMENT 'id' ,
merchant_id INT COMMENT '商户id' ,
rule_type CHAR(1) COMMENT '分仓规则类型 1-按商品发货仓分仓2-按订单商品种类分仓' ,
warehouse_id INT COMMENT '仓库id' ,
create_at DATETIME COMMENT '创建时间' ,
create_by INT COMMENT '创建人' ,
update_at DATETIME COMMENT '更新时间' ,
update_by INT COMMENT '更新人' ,
PRIMARY KEY (id)
) COMMENT = '商户分仓规则 ';
insert into merchant_warehouse_rule(merchant_id,rule_type,create_at,create_by)
select id as merchant_id, '1' as rule_type, now() as create_at, create_by from merchant_info;
part2
alter table mall_trade.order_info modify column `pay_way` char(1) COMMENT '支付方式: 1:微信2:对公3:礼品卡兑换4:生日券兑换5:节日券兑换6:积分兑换7:微信+积分混合支付8:特殊对公';
alter table mall_trade.order_return modify column `pay_way` char(1) COMMENT '支付方式: 1:微信2:对公4:生日券兑换5:节日券兑换6:积分兑换7:微信+积分混合支付8:特殊对公';
alter table mall_trade.pay_transaction modify column `pay_way` char(1) COMMENT '支付方式: 1:微信2:对公3:礼品卡兑换4:生日券兑换5:节日券兑换6:积分兑换7:微信+积分混合支付8:特殊对公';
alter table mall_trade.pay_transaction_return modify column `pay_way` char(1) COMMENT '支付方式: 1:微信2:对公3:礼品卡兑换4:生日券兑换5:节日券兑换6:积分兑换7:微信+积分混合支付8:特殊对公';
alter table mall_trade.payment_transaction_log modify column `pay_way` char(1) COMMENT '支付方式: 1:微信2:对公3:礼品卡兑换4:生日券兑换5:节日券兑换6:积分兑换7:微信+积分混合支付8:特殊对公';
CREATE TABLE giftcard_batch_sku_detail(
id INT NOT NULL AUTO_INCREMENT COMMENT 'id' ,
batch_id VARCHAR(32) COMMENT '批次编号' ,
spu_id INT COMMENT '可兑换商品编号' ,
spu_name VARCHAR(128) COMMENT '可兑换商品名称' ,
spu_sub_title VARCHAR(128) COMMENT '可兑换商品副标题' ,
sku_id INT COMMENT '可兑换sku编号' ,
sku_img VARCHAR(128) COMMENT '可兑换sku图片' ,
sku_name VARCHAR(128) COMMENT '可兑换sku名称' ,
sku_property VARCHAR(128) COMMENT '可兑换sku属性' ,
num INT COMMENT '可兑换数量' ,
ware_id VARCHAR(32) COMMENT '兑换商品发货仓库' ,
status CHAR(1) COMMENT '状态 0-停用1-启用' ,
create_by INT COMMENT '创建人' ,
create_at DATETIME COMMENT '创建时间' ,
update_by INT COMMENT '更新人' ,
update_at DATETIME COMMENT '更新时间' ,
PRIMARY KEY (id)
) COMMENT = '礼品卡可兑商品明细 ';
insert into giftcard_batch_sku_detail (batch_id,spu_id,spu_name,spu_sub_title,sku_id,sku_img,sku_name,sku_property,num,ware_id,`status`,create_by,create_at) (
select batch_id,spu_id,spu_name,spu_sub_title,sku_id,sku_img,sku_name,sku_property,num,ware_id,'1' as `status`,1 as create_by,now() as create_at
from giftcard_batch
where type = '1'
)
create index idx_bid_status on giftcard_batch_detail(`batch_id`, `status`);