Commit 5e07ad06 by 林冲

第六步设置deleteflag

1 parent 8dee3200
......@@ -71,7 +71,7 @@ class SceneSplitProcessor:
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
WHERE
scene_type = {scene_type}
scene_type = {scene_type} and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
if self.db.execute_update(update_sql):
......@@ -99,7 +99,7 @@ class SceneSplitProcessor:
SELECT id, source, merchant_id, scene_type, enable_flag, submit_flag,
created_by, created_date, updated_by, updated_date, deleted_flag
FROM {table_name}
WHERE scene_type = 0 AND (base_scene_code IS NULL OR base_scene_code = '');
WHERE scene_type = 0 AND (base_scene_code IS NULL OR base_scene_code = '') and merchant_id = 44210895;
"""
records = self.db.execute_query(query_sql)
self.logger.info(f" 找到 {len(records)} 条需要拆分的记录")
......@@ -124,7 +124,7 @@ class SceneSplitProcessor:
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
WHERE
scene_type = 0
scene_type = 0 and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
self.logger.info(f" 执行更新SQL: {update_sql.strip()}")
......@@ -259,7 +259,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{base_scene_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
WHERE scene_type = {scene_type}
WHERE scene_type = {scene_type} and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
if self.db.execute_update(update_sql):
......@@ -293,7 +293,7 @@ class SceneSplitProcessor:
reality_shop_merchant_id, reality_shop_merchant_name, reality_shop_user_type, reality_shop_level,
rule_audit_id, created_by, created_date, updated_by, updated_date, deleted_flag
FROM {table_name}
WHERE scene_type = 0
WHERE scene_type = 0 and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
records = self.db.execute_query(query_sql)
......@@ -318,7 +318,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{first_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
WHERE scene_type = 0
WHERE scene_type = 0 and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
if self.db.execute_update(update_sql):
......@@ -1017,7 +1017,7 @@ class SceneSplitProcessor:
SELECT id, rule_type, goods_type_group_rule_id, expense_category_id, expense_category_name,
parent_expense_category_id, parent_expense_category_name, target_type, node_type,
parent_id, category_to_sort, calculate_mode, expense_category_calculate_type,
expense_category_value, target_merchant_id, target_merchant_name
expense_category_value, target_merchant_id, target_merchant_name, deleted_flag
FROM {table_name}
WHERE rule_type = 1
AND goods_type_group_rule_id = {old_goods_type_group_rule_id};
......@@ -1040,6 +1040,7 @@ class SceneSplitProcessor:
expense_category_value = record[13] if record[13] is not None else 'NULL'
target_merchant_id = record[14] if record[14] is not None else 'NULL'
target_merchant_name = f"'{record[15]}'" if record[15] is not None else 'NULL'
deleted_flag = record[16] if record[16] is not None else 'N'
insert_batch.append({
'old_id': old_id,
......@@ -1058,6 +1059,7 @@ class SceneSplitProcessor:
'expense_category_value': expense_category_value,
'target_merchant_id': target_merchant_id,
'target_merchant_name': target_merchant_name,
'deleted_flag': deleted_flag,
'base_scene_code': base_scene_code,
'merchant_id': merchant_id
})
......@@ -1088,7 +1090,7 @@ class SceneSplitProcessor:
f"{item['category_to_sort']}, {item['calculate_mode']}, "
f"{item['expense_category_calculate_type']}, {item['expense_category_value']}, "
f"{item['target_merchant_id']}, {item['target_merchant_name']}, "
f"'{DATA_MIGRATION_USER}', NOW(), '{DATA_MIGRATION_USER}', NOW(), 'N')"
f"'{DATA_MIGRATION_USER}', NOW(), '{DATA_MIGRATION_USER}', NOW(), '{item['deleted_flag']}')"
)
insert_sql = f"""
......@@ -1528,7 +1530,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{base_scene_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
WHERE scene_type = {scene_type}
WHERE scene_type = {scene_type} and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
if self.db.execute_update(update_sql):
......@@ -1560,7 +1562,7 @@ class SceneSplitProcessor:
partner_merchant_total_fee_calculate_type, partner_merchant_expense_category_value,
enable_flag, submit_flag, created_by, created_date, updated_by, updated_date, deleted_flag
FROM {table_name}
WHERE scene_type = 0
WHERE scene_type = 0 and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
records = self.db.execute_query(query_sql)
......@@ -1585,7 +1587,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{first_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
WHERE scene_type = 0
WHERE scene_type = 0 and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
if self.db.execute_update(update_sql):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!