Commit 91986133 by 林冲

DATA_MIGRATION2

1 parent 64390e20
......@@ -155,7 +155,7 @@ merchant_goods_code 补齐程序使用说明
- 匹配到1个 merchant_goods_code:更新原记录
- 匹配到多个 merchant_goods_code:原记录更新第一个,其余复制插入新记录
- 复制插入前检查是否已存在相同记录,避免重复
- 所有新记录标记 created_by='DATA_MIGRATION'
- 所有新记录标记 created_by='DATA_MIGRATION2', updated_by='DATA_MIGRATION2'
临时表说明:
- tmp_goods_relation_context: 规则上下文表,记录每条关系的规则链路信息
......
......@@ -7,7 +7,7 @@ merchant_goods_code 补齐处理器
import logging
from datetime import datetime
from scene_type_mapping import DATA_MIGRATION_USER
from scene_type_mapping import DATA_MIGRATION_USER, DATA_MIGRATION_USER2
class MerchantGoodsCodeProcessor:
......@@ -582,7 +582,7 @@ class MerchantGoodsCodeProcessor:
update_sql = f"""
UPDATE dj_car_life_goods_type_group_relation
SET merchant_goods_code = '{merchant_goods_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER2}',
updated_date = NOW()
WHERE id = {relation_id};
"""
......@@ -618,7 +618,7 @@ class MerchantGoodsCodeProcessor:
rule_type, goods_type_group_rule_id, category_type, upgrade_goods_id,
'{merchant_goods_code}' AS merchant_goods_code,
goods_type, goods_type_name, package_code, package_name,
deleted_flag, '{DATA_MIGRATION_USER}', NOW(), '{DATA_MIGRATION_USER}', NOW()
deleted_flag, '{DATA_MIGRATION_USER2}', NOW(), '{DATA_MIGRATION_USER2}', NOW()
FROM dj_car_life_goods_type_group_relation
WHERE id = {relation_id};
"""
......@@ -684,7 +684,7 @@ class MerchantGoodsCodeProcessor:
update_sql = f"""
UPDATE dj_car_life_goods_type_group_relation
SET merchant_goods_code = CASE id {case_when_clause} END,
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER2}',
updated_date = NOW()
WHERE id IN ({ids_clause});
"""
......@@ -774,7 +774,7 @@ class MerchantGoodsCodeProcessor:
{f"'{goods_type_name}'" if goods_type_name else 'NULL'},
{f"'{package_code}'" if package_code else 'NULL'},
{f"'{package_name}'" if package_name else 'NULL'},
'{deleted_flag}', '{DATA_MIGRATION_USER}', NOW(), '{DATA_MIGRATION_USER}', NOW()
'{deleted_flag}', '{DATA_MIGRATION_USER2}', NOW(), '{DATA_MIGRATION_USER2}', NOW()
)""")
if values_parts:
......
......@@ -25,6 +25,7 @@ SCENE_TYPE_0_SPLIT = [
# 数据迁移标识
DATA_MIGRATION_USER = 'DATA_MIGRATION'
DATA_MIGRATION_USER2 = 'DATA_MIGRATION2'
def get_base_scene_code(scene_type):
"""
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!