# ============================================================================= # 企微IT智能服务台 — 会议室报修记录模型 # ============================================================================= # 说明:记录员工通过小鱼终端提交的会议室设备报修 # 报修提交后自动创建IT工单会话(Conversation),关联conversation_id # 同时通过企微消息通知IT管理员 # ============================================================================= from datetime import datetime from sqlalchemy import DateTime, Integer, String, Text, func from sqlalchemy.orm import Mapped, mapped_column from app.database import Base class MeetingroomRepair(Base): """会议室报修记录模型。 员工在终端上发起报修后,记录报修信息并关联创建的IT工单会话。 报修状态跟随工单会话状态流转。 Attributes: id: 自增主键 terminal_sn: 终端序列号 meetingroom_id: 企微会议室ID meetingroom_name: 会议室名称(冗余) device_type: 故障设备类型(projector/video_conf/aircon/desk_chair/network/other) fault_description: 故障描述 reporter_name: 报修人姓名(可能匿名) reporter_userid: 报修人企微userid(可能为空) conversation_id: 关联的IT工单会话ID status: 报修状态(0=待处理 1=处理中 2=已解决 3=已关闭) created_at: 创建时间 updated_at: 更新时间 """ __tablename__ = "meetingroom_repair" # 自增主键 id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) # 终端序列号 terminal_sn: Mapped[str] = mapped_column(String(64), index=True, nullable=False, comment="终端序列号") # 企微会议室ID meetingroom_id: Mapped[int] = mapped_column(Integer, index=True, nullable=False, comment="企微会议室ID") # 会议室名称(冗余,便于报修列表展示) meetingroom_name: Mapped[str] = mapped_column(String(100), nullable=False, default="", comment="会议室名称") # 故障设备类型 device_type: Mapped[str] = mapped_column(String(50), nullable=False, comment="故障设备类型") # 故障描述 fault_description: Mapped[str] = mapped_column(Text, nullable=False, comment="故障描述") # 报修人姓名(可能匿名) reporter_name: Mapped[str] = mapped_column(String(100), nullable=False, default="匿名", comment="报修人姓名") # 报修人企微userid(可能为空) reporter_userid: Mapped[str] = mapped_column(String(64), nullable=False, default="", comment="报修人企微userid") # 关联的IT工单会话ID conversation_id: Mapped[str] = mapped_column(String(36), index=True, nullable=False, comment="关联IT工单会话ID") # 报修状态 status: Mapped[int] = mapped_column(Integer, nullable=False, default=0, comment="报修状态: 0=待处理 1=处理中 2=已解决 3=已关闭") # 创建时间 created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), nullable=False) # 更新时间 updated_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), onupdate=func.now(), nullable=False) def __repr__(self) -> str: return ( f"" )