This commit is contained in:
cjw
2026-02-16 15:33:52 +08:00
parent 745c32ea26
commit 5a7a4e6a03
4 changed files with 203 additions and 2 deletions
+29
View File
@@ -326,3 +326,32 @@ class SystemLog(Base):
def __repr__(self):
return f"<SystemLog(id={self.id}, level='{self.level}', module='{self.module}')>"
class AnalysisResultSnapshot(Base):
"""分析结果快照表 - 存储每次分析结果的完整副本"""
__tablename__ = "analysis_result_snapshots"
id = Column(Integer, primary_key=True, index=True)
stp_file_id = Column(Integer, ForeignKey("stp_files.id"), nullable=False, index=True)
# 快照标识信息
snapshot_name = Column(String(255), nullable=False, index=True) # 文件名+日期时间格式
snapshot_type = Column(String(50), default="complete") # complete, geometry_only, key_info_only
# 完整分析结果数据
task_data = Column(JSON, nullable=False) # 任务基本信息
geometry_data = Column(JSON, nullable=True) # 几何数据
mold_cavity_data = Column(JSON, nullable=True) # 模具型腔数据
key_info = Column(JSON, nullable=True) # 关键信息
html_info = Column(JSON, nullable=True) # HTML文件信息
# 时间戳
created_time = Column(DateTime, default=func.now())
analysis_time = Column(DateTime, nullable=False) # 原始分析时间
# 关联关系
stp_file = relationship("STPFile")
def __repr__(self):
return f"<AnalysisResultSnapshot(id={self.id}, snapshot_name='{self.snapshot_name}', stp_file_id={self.stp_file_id})>"