数据查询,账号字段增加
This commit is contained in:
@@ -49,10 +49,46 @@ class SectionDataService(BaseService[SectionData]):
|
||||
conditions['id'] = id
|
||||
if mileage is not None:
|
||||
conditions['mileage'] = mileage
|
||||
|
||||
section_data = self.search_by_conditions(db, conditions)
|
||||
# 查询对应观察点数据
|
||||
if len(section_data) > 0:
|
||||
|
||||
return self.search_by_conditions(db, conditions)
|
||||
|
||||
def search_sections_with_checkpoints(self, db: Session,
|
||||
id: Optional[int] = None,
|
||||
section_id: Optional[str] = None,
|
||||
mileage: Optional[str] = None,
|
||||
work_site: Optional[str] = None,
|
||||
number: Optional[str] = None,
|
||||
status: Optional[str] = None) -> List[Dict[str, Any]]:
|
||||
"""查询断面数据并返回带观测点的结果"""
|
||||
sections = self.search_section_data(db, id, section_id, mileage, work_site, number, status)
|
||||
|
||||
result = []
|
||||
for section in sections:
|
||||
checkpoints = self.checkpoint_service.get_by_section_id(db, section.section_id)
|
||||
|
||||
section_dict = {
|
||||
"id": section.id,
|
||||
"section_id": section.section_id,
|
||||
"mileage": section.mileage,
|
||||
"work_site": section.work_site,
|
||||
"basic_types": section.basic_types,
|
||||
"height": section.height,
|
||||
"status": section.status,
|
||||
"number": section.number,
|
||||
"transition_paragraph": section.transition_paragraph,
|
||||
"checkpoints": [
|
||||
{
|
||||
"id": cp.id,
|
||||
"point_id": cp.point_id,
|
||||
"aname": cp.aname,
|
||||
"burial_date": cp.burial_date,
|
||||
"section_id": cp.section_id
|
||||
} for cp in checkpoints
|
||||
]
|
||||
}
|
||||
result.append(section_dict)
|
||||
|
||||
return result
|
||||
|
||||
def get_section_with_checkpoints(self, db: Session, section_id: str) -> Dict[str, Any]:
|
||||
"""获取断面数据及其关联的观测点"""
|
||||
|
||||
Reference in New Issue
Block a user