|
@@ -52,7 +52,6 @@ class WaterResourceProjectListSchema(BaseModel):
|
|
|
@router.post("/projects/")
|
|
|
def create_projects(project_list_data: WaterResourceProjectListSchema, db: Session = Depends(get_db)):
|
|
|
projects = project_list_data.projects
|
|
|
- print(projects)
|
|
|
if not projects: # 确保列表不为空
|
|
|
raise HTTPException(status_code=400, detail="项目列表不能为空")
|
|
|
try:
|
|
@@ -109,8 +108,8 @@ def get_projects(page: int = Query(default=1, gt=0),
|
|
|
"code": 200,
|
|
|
'msg': '查询成功',
|
|
|
'total': total_count,
|
|
|
- 'pages': (total_count + pageSize - 1) // pageSize,
|
|
|
- 'currentPage': page,
|
|
|
+ 'totalPages': (total_count + pageSize - 1) // pageSize,
|
|
|
+ 'page': page,
|
|
|
'pageSize': pageSize,
|
|
|
'data': result_items
|
|
|
}
|
|
@@ -234,8 +233,8 @@ def get_units(page: int = Query(default=1, gt=0),
|
|
|
"code": 200,
|
|
|
'msg': '查询成功',
|
|
|
'total': total_count,
|
|
|
- 'pages': (total_count + pageSize - 1) // pageSize,
|
|
|
- 'currentPage': page,
|
|
|
+ 'totalPages': (total_count + pageSize - 1) // pageSize,
|
|
|
+ 'page': page,
|
|
|
'pageSize': pageSize,
|
|
|
'data': result_items
|
|
|
}
|
|
@@ -360,8 +359,8 @@ def get_rescue_personnel(page: int = Query(default=1, gt=0),
|
|
|
"code": 200,
|
|
|
'msg': '查询成功',
|
|
|
'total': total_count,
|
|
|
- 'pages': (total_count + pageSize - 1) // pageSize,
|
|
|
- 'currentPage': page,
|
|
|
+ 'totalPages': (total_count + pageSize - 1) // pageSize,
|
|
|
+ 'page': page,
|
|
|
'pageSize': pageSize,
|
|
|
'data': result_items
|
|
|
}
|
|
@@ -520,8 +519,8 @@ def get_rescue_stations(page: int = Query(default=1, gt=0),
|
|
|
"code": 200,
|
|
|
'msg': '查询成功',
|
|
|
'total': total_count,
|
|
|
- 'pages': (total_count + pageSize - 1) // pageSize,
|
|
|
- 'currentPage': page,
|
|
|
+ 'totalPages': (total_count + pageSize - 1) // pageSize,
|
|
|
+ 'page': page,
|
|
|
'pageSize': pageSize,
|
|
|
'data': result_items
|
|
|
}
|
|
@@ -660,16 +659,16 @@ def get_defense_projects(page: int = Query(default=1, gt=0),
|
|
|
projects = data_query.offset(offset).limit(pageSize).all()
|
|
|
|
|
|
# 构造结果
|
|
|
- result_items = [project.to_dict() for project in projects]
|
|
|
+ # result_items = [project.to_dict() for project in projects]
|
|
|
|
|
|
result = {
|
|
|
"code": 200,
|
|
|
'msg': '查询成功',
|
|
|
'total': total_count,
|
|
|
- 'pages': (total_count + pageSize - 1) // pageSize,
|
|
|
- 'currentPage':page,
|
|
|
+ 'totalPages': (total_count + pageSize - 1) // pageSize,
|
|
|
+ 'page': page,
|
|
|
'pageSize': pageSize,
|
|
|
- 'data': result_items
|
|
|
+ 'data': projects
|
|
|
}
|
|
|
|
|
|
return result
|
|
@@ -780,8 +779,8 @@ def get_shelters(page: int = Query(default=1, gt=0),
|
|
|
"code": 200,
|
|
|
'msg': '查询成功',
|
|
|
'total': total_count,
|
|
|
- 'pages': (total_count + pageSize - 1) // pageSize,
|
|
|
- 'currentPage': page,
|
|
|
+ 'totalPages': (total_count + pageSize - 1) // pageSize,
|
|
|
+ 'page': page,
|
|
|
'pageSize': pageSize,
|
|
|
'data': result_items
|
|
|
}
|