33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
"""fin_product 公募基金产品表 ORM 模型。"""
|
|
from __future__ import annotations
|
|
|
|
from datetime import date, datetime
|
|
from decimal import Decimal
|
|
|
|
from sqlalchemy import BigInteger, Date, DateTime, Integer, Numeric, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from model.base import Base
|
|
|
|
|
|
class FinProduct(Base):
|
|
__tablename__ = "fin_product"
|
|
__table_args__ = {"comment": "公募基金产品表"}
|
|
|
|
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
|
|
product_code: Mapped[str] = mapped_column(String(32), unique=True)
|
|
product_name: Mapped[str] = mapped_column(String(128))
|
|
product_type: Mapped[str] = mapped_column(String(32))
|
|
risk_level: Mapped[str] = mapped_column(String(8))
|
|
expected_return: Mapped[Decimal | None] = mapped_column(Numeric(7, 4))
|
|
nav: Mapped[Decimal | None] = mapped_column(Numeric(12, 6))
|
|
nav_date: Mapped[date | None] = mapped_column(Date)
|
|
fee_rate: Mapped[Decimal] = mapped_column(Numeric(6, 4), server_default="0.0000")
|
|
term_days: Mapped[int] = mapped_column(Integer, server_default="0")
|
|
fund_manager: Mapped[str | None] = mapped_column(String(64))
|
|
status: Mapped[str] = mapped_column(String(16), server_default="在售")
|
|
create_time: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
|
update_time: Mapped[datetime] = mapped_column(
|
|
DateTime, server_default=func.now(), onupdate=func.now()
|
|
)
|