产图记录
This commit is contained in:
@@ -27,5 +27,31 @@ class QgisRepository:
|
||||
"condition": row["condition"] if isinstance(row["condition"], dict) else {},
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def insert_file_paths(inference_id: int, paths: list[str]) -> None:
|
||||
"""实时写入文件路径到进度表(唯一索引自动去重)"""
|
||||
if not paths:
|
||||
return
|
||||
import os
|
||||
sql = """
|
||||
INSERT INTO xian_inference_result_file (inference_id, file_path, file_name)
|
||||
VALUES (%s, %s, %s)
|
||||
ON CONFLICT DO NOTHING
|
||||
"""
|
||||
for p in paths:
|
||||
name = os.path.basename(p)
|
||||
db_helper.execute_update(sql, (inference_id, p, name))
|
||||
|
||||
@staticmethod
|
||||
def get_file_paths(inference_id: int) -> list[str]:
|
||||
"""获取已产出的文件路径列表(从进度表)"""
|
||||
sql = """
|
||||
SELECT file_path FROM xian_inference_result_file
|
||||
WHERE inference_id = %s AND is_delete = 0
|
||||
ORDER BY create_time
|
||||
"""
|
||||
rows = db_helper.execute_query(sql, (inference_id,))
|
||||
return [r["file_path"] for r in rows]
|
||||
|
||||
|
||||
qgis_repository = QgisRepository()
|
||||
|
||||
Reference in New Issue
Block a user