初始化集成qgis
This commit is contained in:
@@ -2,5 +2,6 @@
|
||||
Repositories package - 数据访问层
|
||||
"""
|
||||
from app.repositories.rainfall_repository import rainfall_repository, RainfallRepository
|
||||
from app.repositories.qgis_repository import qgis_repository, QgisRepository
|
||||
|
||||
__all__ = ['rainfall_repository', 'RainfallRepository']
|
||||
__all__ = ['rainfall_repository', 'RainfallRepository', 'qgis_repository', 'QgisRepository']
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
from app.config.paths import get_logger
|
||||
from app.utils.db_helper import db_helper
|
||||
|
||||
logger = get_logger("qgis")
|
||||
|
||||
|
||||
class QgisRepository:
|
||||
|
||||
@staticmethod
|
||||
def query_inference_result(inference_id: int) -> dict:
|
||||
"""根据 inferenceId 查询 xian_inference_result"""
|
||||
sql = """
|
||||
SELECT id, name, event_type, occurred_time, condition
|
||||
FROM xian_inference_result
|
||||
WHERE id = %s
|
||||
"""
|
||||
rows = db_helper.execute_query(sql, (inference_id,))
|
||||
if not rows:
|
||||
raise ValueError(f"推理结果不存在: id={inference_id}")
|
||||
|
||||
row = rows[0]
|
||||
return {
|
||||
"id": row[0],
|
||||
"name": row[1] or "",
|
||||
"event_type": row[2] or "",
|
||||
"occurred_time": row[3],
|
||||
"condition": row[4] if isinstance(row[4], dict) else {},
|
||||
}
|
||||
|
||||
|
||||
qgis_repository = QgisRepository()
|
||||
Reference in New Issue
Block a user