34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
"""ORM mapping for the additive customer benefit catalog.
|
||||
|
|
|
|||
|
|
只映射新增的 `fin_customer_benefit`(层级 → 权益条目)。
|
|||
|
|
**不映射"某客户享有哪些权益"** —— 那可由客户层级实时推出,落库会造成双份真相。
|
|||
|
|
客户层级本身仍以 `sys_user.customer_tier`(`app.model.fund`)与
|
|||
|
|
`fin_customer_profile.total_asset` 为准,本模块不改它们。
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
from datetime import datetime
|
|||
|
|
|
|||
|
|
from sqlalchemy import BigInteger, DateTime, Integer, String
|
|||
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|||
|
|
|
|||
|
|
from app.model.base import Base
|
|||
|
|
|
|||
|
|
|
|||
|
|
class CustomerBenefit(Base):
|
|||
|
|
"""客户权益目录:一条 = 某个层级享有的一项权益。"""
|
|||
|
|
|
|||
|
|
__tablename__ = "fin_customer_benefit"
|
|||
|
|
|
|||
|
|
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
|||
|
|
benefit_code: Mapped[str] = mapped_column(String(64), nullable=False)
|
|||
|
|
#: 英文层级码(gold/platinum/diamond/private);中文名由接口层映射。
|
|||
|
|
customer_tier: Mapped[str] = mapped_column(String(16), nullable=False)
|
|||
|
|
#: financial / non_financial
|
|||
|
|
category: Mapped[str] = mapped_column(String(16), nullable=False)
|
|||
|
|
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
|||
|
|
description: Mapped[str] = mapped_column(String(512), nullable=False)
|
|||
|
|
display_order: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
|||
|
|
status: Mapped[str] = mapped_column(String(16), nullable=False)
|
|||
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
|||
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|