model.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from sqlalchemy import String, Text
  2. from sqlalchemy.orm import Mapped, mapped_column
  3. from app.common.enums import PermissionFilterStrategy
  4. from app.core.base_model import PaymentModelMixin, TenantMixin, EnterpriseMixin
  5. from .enums import RuleStatusEnum
  6. class ExpenseRuleModel(PaymentModelMixin, TenantMixin, EnterpriseMixin):
  7. """使用规则模型"""
  8. __tablename__ = "pay_expense_rule"
  9. __table_args__ = {"comment": "使用规则表"}
  10. __permission_strategy__ = PermissionFilterStrategy.ENTERPRISE_BASED
  11. out_biz_no: Mapped[str] = mapped_column(
  12. String(64), unique=True, index=True, comment="外部业务编号"
  13. )
  14. institution_id: Mapped[str] = mapped_column(
  15. String(64), index=True, comment="制度ID"
  16. )
  17. rule_id: Mapped[str | None] = mapped_column(
  18. String(64), comment="规则ID(支付宝返回)"
  19. )
  20. standard_name: Mapped[str | None] = mapped_column(
  21. String(128), comment="规则名称"
  22. )
  23. standard_desc: Mapped[str | None] = mapped_column(
  24. Text, comment="规则描述"
  25. )
  26. expense_type_sub_category: Mapped[str | None] = mapped_column(
  27. String(32), comment="费用类型子类"
  28. )
  29. status: Mapped[str] = mapped_column(
  30. String(32),
  31. default=RuleStatusEnum.RULE_ACTIVE.value,
  32. comment="状态: RULE_ACTIVE/RULE_INACTIVE"
  33. )