# -*- coding: utf-8 -*- from typing import TYPE_CHECKING from sqlalchemy import DECIMAL, String, DateTime, Text, Integer from sqlalchemy.orm import relationship,Mapped, mapped_column from decimal import Decimal # Python内置Decimal from app.core.base_model import ModelMixin, UserMixin if TYPE_CHECKING: from app.api.v1.module_business.vardict.model import BizVarDictModel class BizCraneModel(ModelMixin, UserMixin): """ 行车信息表 """ __tablename__: str = 'biz_crane' __table_args__: dict[str, str] = {'comment': '行车信息'} __loader_options__: list[str] = ["created_by", "updated_by"] crane_name: Mapped[str | None] = mapped_column(String(200), nullable=True, comment='行车名称') crane_no: Mapped[str | None] = mapped_column(String(200), nullable=True, comment='行车编号') crane_model: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='行车型号') work_span: Mapped[Decimal | None] = mapped_column(DECIMAL, nullable=True, comment='工作跨度') work_height: Mapped[Decimal | None] = mapped_column(DECIMAL, nullable=True, comment='工作高度') work_weight: Mapped[Decimal | None] = mapped_column(DECIMAL, nullable=True, comment='最大载重') ip_address: Mapped[str | None] = mapped_column(String(50), nullable=True, comment='ip地址') modbus_port: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='modbus端口号') order: Mapped[int | None] = mapped_column(Integer, nullable=True, comment='排序') var_dicts: Mapped[list["BizVarDictModel"]] = relationship( back_populates="crane", foreign_keys="BizVarDictModel.crane_id", lazy="selectin" )