Commit e5b1be6f by 张富康

feat(database): 新增库存记录表商户字段并补充商户信息

- 在 dj_car_life_merchant_goods_stock_reduce_record 表中添加 order_merchant_id 和 order_merchant_name 字段
- 保留已有的 inventory_type 字段,用于区分虚拟或实物库存模式
- 编写更新语句,基于 dj_car_life_goods_order 表的订单信息补充新添加的商户字段
- 只更新未删除且事件类型为1的库存减少记录数据
1 parent aa5ff218
...@@ -64,7 +64,9 @@ create table `dj_car_life_merchant_goods_inventory_type_ref` ...@@ -64,7 +64,9 @@ create table `dj_car_life_merchant_goods_inventory_type_ref`
collate utf8mb4_unicode_ci; collate utf8mb4_unicode_ci;
alter table dj_car_life_merchant_goods_stock_reduce_record alter table dj_car_life_merchant_goods_stock_reduce_record
add column inventory_type tinyint(1) null default 2 comment '库存模式 1-虚拟、2-实物'; add column inventory_type tinyint(1) null default 2 comment '库存模式 1-虚拟、2-实物',
add column order_merchant_id int null comment '下单商户id',
add column order_merchant_name varchar(200) null comment '下单商户名称';
### 富康 -----------------end--------------------- ### 富康 -----------------end---------------------
### 璐琦 -----------------start------------------- ### 璐琦 -----------------start-------------------
......
UPDATE dj_car_life_merchant_goods_stock_reduce_record r
LEFT JOIN dj_car_life_goods_order go
ON go.order_code = r.business_code
AND go.deleted_flag = 'N'
SET
r.order_merchant_id = go.merchant_id,
r.order_merchant_name = go.merchant_name
WHERE
r.deleted_flag = 'N'
AND r.event_type = 1;
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!