document.py 1.8 KB

123456789101112131415161718192021222324252627
  1. from datetime import datetime
  2. from sqlalchemy import BigInteger, DateTime, Integer, String, ForeignKey
  3. from sqlalchemy.dialects.mysql import LONGTEXT
  4. from sqlalchemy.orm import Mapped, mapped_column
  5. from alien_database.base import Base, AuditMixin
  6. class ContractDocument(Base, AuditMixin):
  7. """合同文档"""
  8. __tablename__ = "contract_document"
  9. id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True, comment="合同文档唯一标识")
  10. bundle_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("contract_bundle.id"), index=True, comment="所属合同包ID")
  11. contract_type: Mapped[str] = mapped_column(String(50), comment="合同类型编码(store_agreement/alipay_auth等)")
  12. contract_name: Mapped[str] = mapped_column(String(100), comment="合同展示名称")
  13. is_primary: Mapped[int] = mapped_column(Integer, default=0, comment="是否主合同(1是/0否)")
  14. status: Mapped[int] = mapped_column(Integer, default=0, comment="签署状态(0未签署/1已签署)")
  15. sign_flow_id: Mapped[str] = mapped_column(String(64), unique=True, comment="e签宝签署流程ID")
  16. file_id: Mapped[str] = mapped_column(String(64), comment="e签宝文件ID")
  17. template_url: Mapped[str] = mapped_column(LONGTEXT, comment="合同模板预览URL")
  18. sign_url: Mapped[str] = mapped_column(LONGTEXT, comment="签署链接URL")
  19. download_url: Mapped[str] = mapped_column(LONGTEXT, comment="签署完成后的下载URL")
  20. signing_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True, comment="签署时间")
  21. effective_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True, comment="合同生效时间")
  22. expiry_time: Mapped[datetime | None] = mapped_column(DateTime, nullable=True, comment="合同到期时间")