Commit 528a2026 by 林冲

step11_2_process_expense_category_rule_reconciliation保存category保存tmp

1 parent 4ae3397d
......@@ -837,7 +837,7 @@ class SceneSplitProcessor:
})
# 批量更新
batch_size = 10000
batch_size = 100000
total_count = len(update_batch)
total_batches = (total_count + batch_size - 1) // batch_size
self.logger.info(f" 开始批量更新表2,共 {total_batches} 个批次,每批 {batch_size} 条")
......@@ -1862,8 +1862,15 @@ class SceneSplitProcessor:
"""
if self.db.execute_update(insert_sql):
# 注意:这里不需要建立映射,因为这些记录不会被其他表引用
copy_count += len(batch)
# 获取起始ID
first_new_id = self.db.execute_query_one("SELECT LAST_INSERT_ID();")[0]
# 建立映射关系并保存到 tmp_rule_id_mapping
for i, item in enumerate(batch):
new_id = first_new_id + i
self.id_mapper.add_mapping(table_name, item['old_id'], new_id, item['base_scene_code'])
copy_count += 1
self.logger.info(f" 批次 {batch_num}/{total_batches} 插入完成,本批 {len(batch)} 条,累计 {copy_count} 条")
self.logger.info(f"第11步-2完成,共复制 {copy_count} 条记录")
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!