1.通过accountid获取所有断面数据
This commit is contained in:
@@ -17,7 +17,8 @@ from ..schemas.comprehensive_data import (
|
||||
SettlementDataCheckpointQueryRequest,
|
||||
LevelDataQueryRequest,
|
||||
LinecodeRequest,
|
||||
NYIDRequest
|
||||
NYIDRequest,
|
||||
SectionByAccountRequest
|
||||
)
|
||||
from ..services.daily import DailyDataService
|
||||
from ..services.section_data import SectionDataService
|
||||
@@ -402,4 +403,26 @@ def get_today_data(db: Session = Depends(get_db)):
|
||||
message=f"定时任务触发失败:{str(e)}",
|
||||
total=0,
|
||||
data={}
|
||||
)
|
||||
# 查询断面数据对应观察点数据
|
||||
@router.post("/get_all_section_by_account", response_model=DataResponse)
|
||||
def get_all_section_by_account(request: SectionByAccountRequest, db: Session = Depends(get_db)):
|
||||
"""获取断面数据 + 观测点"""
|
||||
try:
|
||||
account_id = request.account_id
|
||||
section_service = SectionDataService()
|
||||
result_data = section_service.get_all_section_by_account(db, account_id=account_id)
|
||||
return DataResponse(
|
||||
code=ResponseCode.SUCCESS,
|
||||
message="查询成功",
|
||||
total=len(result_data),
|
||||
data=result_data
|
||||
)
|
||||
except Exception as e:
|
||||
logger.error(f"Query section data failed: {str(e)}")
|
||||
return DataResponse(
|
||||
code=ResponseCode.QUERY_FAILED,
|
||||
message=f"{ResponseMessage.QUERY_FAILED}: {str(e)}",
|
||||
total=0,
|
||||
data=[]
|
||||
)
|
||||
Reference in New Issue
Block a user