新增内部查询方法,替换simulation中scada设备查询方法

This commit is contained in:
JIANG
2025-12-09 15:10:10 +08:00
parent 357bacbf8a
commit 1d55bf4992
5 changed files with 102 additions and 42 deletions

View File

@@ -358,20 +358,20 @@ async def insert_scada_data(
@router.get("/scada")
async def get_scada_by_id_time_range(
device_id: str,
async def get_scada_by_ids_time_range(
device_ids: List[str],
start_time: datetime,
end_time: datetime,
conn: AsyncConnection = Depends(get_database_connection),
):
return await ScadaRepository.get_scada_by_id_time_range(
conn, device_id, start_time, end_time
return await ScadaRepository.get_scada_by_ids_time_range(
conn, device_ids, start_time, end_time
)
@router.get("/scada/{device_id}/field")
async def get_scada_field_by_id_time_range(
device_id: str,
@router.get("/scada/field")
async def get_scada_field_by_ids_time_range(
device_ids: List[str],
start_time: datetime,
end_time: datetime,
field: str,
@@ -379,7 +379,7 @@ async def get_scada_field_by_id_time_range(
):
try:
return await ScadaRepository.get_scada_field_by_id_time_range(
conn, device_id, start_time, end_time, field
conn, device_ids, start_time, end_time, field
)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))