From cef797782c0670e7a86117be542a11e8b846d1ec Mon Sep 17 00:00:00 2001 From: admin <392153814@qq.com> Date: Sun, 15 Mar 2026 11:34:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20app/models/level=5Fdat?= =?UTF-8?q?a.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit losedata对象增加 --- app/models/level_data.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/app/models/level_data.py b/app/models/level_data.py index 17d4e92..e82e927 100644 --- a/app/models/level_data.py +++ b/app/models/level_data.py @@ -20,6 +20,26 @@ class LevelData(Base): temperature = Column(String(100), comment="温度") weather = Column(String(100), comment="天气") + # 模型转字典 + def to_dict(self): + """将模型实例转换为字典,支持 Pydantic 序列化""" + return { + column.name: getattr(self, column.name) + for column in self.__table__.columns + } + +class LoseData(Base): + __tablename__ = "lose_data" + + id = Column(Integer, primary_key=True, index=True, autoincrement=True) + account_id = Column(String(100), nullable=False, comment="水准线路编码", index=True) + NYID = Column(String(100), nullable=False, comment="期数id", index=True) + linecode = Column(String(100), nullable=False, comment="水准线路编码", index=True) + benchmarkids = Column(String(100), comment="工作基点名称序列") + point_id = Column(String(100), nullable=False, comment="观测点id", index=True) + section_id = Column(String(100), nullable=False, comment="所属断面id") + lose_data = Column(String(100), comment="水准观测类型") + # 模型转字典 def to_dict(self): """将模型实例转换为字典,支持 Pydantic 序列化""" From 08b556fa6e96c71bc757e9aa393457d0bbf0589b Mon Sep 17 00:00:00 2001 From: admin <392153814@qq.com> Date: Sun, 15 Mar 2026 11:39:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=E3=80=8Capp/models=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加losedata对象 --- app/models/lose_data.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/models/lose_data.py diff --git a/app/models/lose_data.py b/app/models/lose_data.py new file mode 100644 index 0000000..07ec485 --- /dev/null +++ b/app/models/lose_data.py @@ -0,0 +1,22 @@ +from sqlalchemy import Column, Integer, String, DateTime +from ..core.database import Base + +class LoseData(Base): + __tablename__ = "lose_data" + + id = Column(Integer, primary_key=True, index=True, autoincrement=True) + account_id = Column(String(100), nullable=False, comment="水准线路编码", index=True) + NYID = Column(String(100), nullable=False, comment="期数id", index=True) + linecode = Column(String(100), nullable=False, comment="水准线路编码", index=True) + benchmarkids = Column(String(100), comment="工作基点名称序列") + point_id = Column(String(100), nullable=False, comment="观测点id", index=True) + section_id = Column(String(100), nullable=False, comment="所属断面id") + lose_data = Column(String(100), comment="水准观测类型") + + # 模型转字典 + def to_dict(self): + """将模型实例转换为字典,支持 Pydantic 序列化""" + return { + column.name: getattr(self, column.name) + for column in self.__table__.columns + } \ No newline at end of file