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

58 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 typing import Optional
from sqlalchemy import String, Boolean, DECIMAL
from sqlalchemy.orm import Mapped, mapped_column
from app.models.base import BaseModel
class Material(BaseModel):
"""耗材表"""
__tablename__ = "materials"
material_code: Mapped[str] = mapped_column(
String(50),
unique=True,
nullable=False,
index=True,
comment="耗材编码"
)
material_name: Mapped[str] = mapped_column(
String(100),
nullable=False,
comment="耗材名称"
)
unit: Mapped[str] = mapped_column(
String(20),
nullable=False,
comment="单位(支/ml/个)"
)
unit_price: Mapped[float] = mapped_column(
DECIMAL(12, 2),
nullable=False,
comment="单价"
)
supplier: Mapped[Optional[str]] = mapped_column(
String(100),
nullable=True,
comment="供应商"
)
material_type: Mapped[str] = mapped_column(
String(20),
nullable=False,
index=True,
comment="类型consumable-耗材, injectable-针剂, product-产品"
)
is_active: Mapped[bool] = mapped_column(
Boolean,
nullable=False,
default=True,
comment="是否启用"
)