"""固定成本模型 管理月度固定成本(房租、水电等)及分摊方式 """ from sqlalchemy import String, Boolean, DECIMAL from sqlalchemy.orm import Mapped, mapped_column from app.models.base import BaseModel class FixedCost(BaseModel): """固定成本表""" __tablename__ = "fixed_costs" cost_name: Mapped[str] = mapped_column( String(100), nullable=False, comment="成本名称" ) cost_type: Mapped[str] = mapped_column( String(20), nullable=False, comment="类型:rent-房租, utilities-水电, property-物业, other-其他" ) monthly_amount: Mapped[float] = mapped_column( DECIMAL(12, 2), nullable=False, comment="月度金额" ) year_month: Mapped[str] = mapped_column( String(7), nullable=False, index=True, comment="年月:2026-01" ) allocation_method: Mapped[str] = mapped_column( String(20), nullable=False, default="count", comment="分摊方式:count-按项目数, revenue-按营收, duration-按时长" ) is_active: Mapped[bool] = mapped_column( Boolean, nullable=False, default=True, comment="是否启用" )