Commit d4129bfa by 张富康

feat(sql): 添加商品库存类型引用表插入操作

- 在dj_smartcarlife_dml.sql中新增插入语句
- 将满足套餐编码为空且未删除条件的商品数据插入dj_car_life_merchant_goods_inventory_type_ref表
- 设置inventory_type默认为2,标识特定库存类型
- 通过inner join关联商品引用表和商品信息表
- 统一创建和更新用户为system,时间为当前时间
- 保证插入的数据deleted_flag标记为'N'
1 parent aaa35cba
......@@ -7,4 +7,31 @@ SET
r.order_merchant_name = go.merchant_name
WHERE
r.deleted_flag = 'N'
AND r.event_type = 1;
\ No newline at end of file
AND r.event_type = 1;
INSERT INTO dj_car_life_merchant_goods_inventory_type_ref
(
merchant_goods_id,
package_code,
inventory_type,
merchant_id,
created_by,
created_date,
updated_by,
updated_date,
deleted_flag
)
SELECT
r.merchant_goods_id,
NULL AS package_code,
2 AS inventory_type,
r.merchant_id,
'system' AS created_by,
NOW() AS created_date,
'system' AS updated_by,
NOW() AS updated_date,
'N' AS deleted_flag
FROM dj_car_life_merchant_goods_ref r inner join dj_car_life_merchant_goods_info i on r.merchant_goods_id = i.id
WHERE
(i.package_code IS NULL OR i.package_code = '') -- 套餐编码为空
AND r.deleted_flag = 'N'; -- 源数据未删除
\ 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!