定时任务优化

This commit is contained in:
lhx
2025-11-18 09:41:52 +08:00
parent 815cd7801c
commit d8b6247094
4 changed files with 86 additions and 30 deletions

View File

@@ -15,6 +15,12 @@ class CheckpointService(BaseService[Checkpoint]):
checkpoints = self.get_by_field(db, "point_id", point_id)
return checkpoints[0] if checkpoints else None
def get_by_point_ids_batch(self, db: Session, point_ids: List[str]) -> List[Checkpoint]:
"""批量根据观测点ID列表获取观测点数据使用IN查询优化性能"""
if not point_ids:
return []
return db.query(Checkpoint).filter(Checkpoint.point_id.in_(point_ids)).all()
def search_checkpoints(self, db: Session,
aname: Optional[str] = None,
section_id: Optional[str] = None,