Initial commit: 智能项目定价模型

This commit is contained in:
kuzma
2026-01-31 21:33:06 +08:00
commit ef0824303f
174 changed files with 31705 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
"""固定成本模型
管理月度固定成本(房租、水电等)及分摊方式
"""
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="是否启用"
)