fix: 修复扇区推断及按CGI更新导入
This commit is contained in:
@@ -297,6 +297,17 @@ def import_table_csv(
|
||||
if extra:
|
||||
parts.append("多余字段: " + ", ".join(extra))
|
||||
raise HTTPException(status_code=400, detail="CSV 字段与模板不一致,导入失败。" + ";".join(parts))
|
||||
if database_source == "cell_data" and table_name.lower() == "sector":
|
||||
stats = db.upsert_csv(str(tmp_path), table_name, "CGI", encoding=encoding)
|
||||
return {
|
||||
"success": True,
|
||||
"message": (
|
||||
f"导入成功,共 {stats['imported_rows']} 行:"
|
||||
f"新增 {stats['inserted_rows']} 行,更新 {stats['updated_rows']} 行,"
|
||||
f"清理历史重复 {stats['removed_duplicate_rows']} 行"
|
||||
),
|
||||
**stats,
|
||||
}
|
||||
imported = db.import_csv(str(tmp_path), table_name, encoding=encoding)
|
||||
except HTTPException:
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user