init project
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, UniqueConstraint
|
||||
from ..database import Base
|
||||
|
||||
|
||||
class BlockConfig(Base):
|
||||
__tablename__ = "block_config"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("template_id", "block_id", name="uq_template_block"),
|
||||
)
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
template_id = Column(Integer, ForeignKey("template.id", ondelete="CASCADE"), nullable=False)
|
||||
block_id = Column(String(50), nullable=False)
|
||||
region_name = Column(String(200), nullable=True, comment="区域名称")
|
||||
region_type = Column(String(30), default="ai_generate", comment="ai_generate/manual/fixed/table")
|
||||
data_sources = Column(Text, nullable=True, comment="数据来源 JSON 数组")
|
||||
prompt = Column(Text, nullable=True, comment="提示词")
|
||||
output_format = Column(String(30), default="formal_paragraph", comment="输出格式")
|
||||
need_review = Column(Integer, default=1, comment="1=需要审核")
|
||||
remark = Column(Text, nullable=True, comment="备注")
|
||||
enabled = Column(Integer, default=1, comment="1=启用")
|
||||
created_at = Column(DateTime, default=datetime.now)
|
||||
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
|
||||
@@ -0,0 +1,17 @@
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
|
||||
from ..database import Base
|
||||
|
||||
|
||||
class Template(Base):
|
||||
__tablename__ = "template"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
name = Column(String(200), nullable=False, comment="模板名称")
|
||||
type = Column(String(50), default="report", comment="报告类/公文类/总结类/合同类")
|
||||
version = Column(String(20), default="v1.0.0", comment="版本号")
|
||||
original_file_path = Column(String(500), nullable=False, comment="原始 Word 文件路径")
|
||||
status = Column(Integer, default=1, comment="1=启用 0=停用")
|
||||
created_by = Column(String(50), comment="创建人")
|
||||
created_at = Column(DateTime, default=datetime.now)
|
||||
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
|
||||
@@ -0,0 +1,20 @@
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey
|
||||
from ..database import Base
|
||||
|
||||
|
||||
class TemplateBlock(Base):
|
||||
__tablename__ = "template_block"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
template_id = Column(Integer, ForeignKey("template.id", ondelete="CASCADE"), nullable=False, comment="所属模板")
|
||||
block_id = Column(String(50), nullable=False, comment="唯一标识 block_001")
|
||||
parent_block_id = Column(String(50), nullable=True, comment="父级 block_id")
|
||||
block_type = Column(String(20), nullable=False, comment="title/heading/paragraph/table")
|
||||
block_name = Column(String(200), nullable=True, comment="区域名称")
|
||||
text_preview = Column(String(500), nullable=True, comment="文本预览")
|
||||
level = Column(Integer, default=0, comment="0=文档标题 1=一级 2=二级")
|
||||
sort_order = Column(Integer, default=0, comment="排序号")
|
||||
table_rows = Column(Integer, nullable=True, comment="表格行数")
|
||||
table_cols = Column(Integer, nullable=True, comment="表格列数")
|
||||
created_at = Column(DateTime, default=datetime.now)
|
||||
Reference in New Issue
Block a user