Files
smart-project-pricing/后端服务/app/models/fixed_cost.py
2026-01-31 21:33:06 +08:00

50 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""固定成本模型
管理月度固定成本(房租、水电等)及分摊方式
"""
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="是否启用"
)