|
@@ -5,13 +5,16 @@ from sqlalchemy.orm import relationship, sessionmaker
|
|
|
Base = declarative_base()
|
|
|
metadata = MetaData()
|
|
|
|
|
|
+from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
|
|
|
+from sqlalchemy.orm import relationship
|
|
|
|
|
|
-class File(Base):
|
|
|
- __tablename__ = 'kownledge_file'
|
|
|
+
|
|
|
+class KnowledgeFile(Base):
|
|
|
+ __tablename__ = 'knowledge_file'
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
file_identifier = Column(String(50), unique=True, nullable=False, comment='文件唯一标识符')
|
|
|
- file_path = Column(String(255), nullable=False, comment='文件存储路径')
|
|
|
+ file_path = Column(Text, nullable=False, comment='文件存储路径')
|
|
|
file_name = Column(String(255), nullable=False, comment='文件名字')
|
|
|
is_deleted = Column(Integer, default=0, comment='是否删除')
|
|
|
|
|
@@ -24,21 +27,24 @@ class KnowledgeBase(Base):
|
|
|
__tablename__ = 'knowledge_base'
|
|
|
|
|
|
# 知识库表主键
|
|
|
- base_id = Column(Integer, primary_key=True)
|
|
|
- # 知识库的基础编码
|
|
|
- base_code = Column(String(50),unique=True, comment='知识库的基础编码')
|
|
|
+ reportId = Column(String(255), primary_key=True)
|
|
|
+ # 报告名称
|
|
|
+ reportName = Column(String(400), comment='报告名称')
|
|
|
# 主题词
|
|
|
- theme_word = Column(String(100), comment='主题词')
|
|
|
- # 事件类型
|
|
|
- event_type = Column(String(100), comment='事件类型')
|
|
|
- # 来源单位
|
|
|
- source_unit = Column(String(100), comment='来源单位')
|
|
|
+ subject = Column(String(100), comment='主题词')
|
|
|
+ # 事件类型 // 事件类型,字典项值(例如,自然灾害)
|
|
|
+ eventType = Column(String(10), comment='事件类型')
|
|
|
# 发布日期
|
|
|
- publish_date = Column(DateTime, comment='发布日期')
|
|
|
- # 知识类型
|
|
|
- knowledge_type = Column(String(100), comment='知识类型')
|
|
|
+ publishDate = Column(DateTime, comment='发布日期')
|
|
|
+ # 来源单位
|
|
|
+ publishingUnit = Column(String(255), comment='来源单位')
|
|
|
# 摘要
|
|
|
- abstract = Column(Text, comment='摘要')
|
|
|
- # 报告名称
|
|
|
- report_name = Column(String(255), comment='报告名称')
|
|
|
- files = relationship("File", order_by=File.id, back_populates="knowledge_base")
|
|
|
+ summary = Column(String(100), comment='摘要')
|
|
|
+ # 知识类型notificationType
|
|
|
+ notificationType = Column(String(100), comment='知识类型')
|
|
|
+
|
|
|
+ # 知识库的基础编码
|
|
|
+ base_code = Column(String(50), unique=True, comment='知识库的基础编码')
|
|
|
+
|
|
|
+ # 关联文件
|
|
|
+ files = relationship("KnowledgeFile", order_by=KnowledgeFile.id, back_populates="knowledge_base")
|