Files
railway_cloud/app/models/level_data.py
2026-03-15 11:34:55 +08:00

49 lines
2.3 KiB
Python

from sqlalchemy import Column, Integer, String, DateTime
from ..core.database import Base
class LevelData(Base):
__tablename__ = "level_data"
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
linecode = Column(String(100), nullable=False, comment="水准线路编码", index=True)
benchmarkids = Column(String(100), comment="工作基点名称序列")
wsphigh = Column(String(100), comment="工作基点高程序列(m)")
NYID = Column(String(100), nullable=False, comment="期数id", index=True)
createDate = Column(DateTime, comment="上传时间")
mtype = Column(String(100), comment="水准观测类型")
wspversion = Column(String(100), comment="版本信息")
barometric = Column(String(100), comment="气压值")
equipbrand = Column(String(100), comment="设备品牌")
instrumodel = Column(String(100), comment="仪器型号")
serialnum = Column(String(100), comment="序列号")
sjname = Column(String(100), comment="事件名称")
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 序列化"""
return {
column.name: getattr(self, column.name)
for column in self.__table__.columns
}