from app.db.db_base import DbCommon from sqlalchemy import String, Integer, JSON from sqlalchemy.orm import Mapped, mapped_column class ProjectType(DbCommon): """ 项目类别表 - 标识项目的类型目前存在的(目标识别,OCR识别,瑕疵检测,图像分类) """ __tablename__ = "project_type" type_code: Mapped[str] = mapped_column(String(20), unique=True, nullable=False) type_name: Mapped[str] = mapped_column(String(20)) icon_path: Mapped[str] = mapped_column(String(255)) description: Mapped[str] = mapped_column(String(255)) type_status: Mapped[str] = mapped_column(String(10)) class ProjectInfo(DbCommon): """项目信息表""" __tablename__ = "project_info" project_no: Mapped[str] = mapped_column(String(32), unique=True, nullable=False) project_name: Mapped[str] = mapped_column(String(32), unique=True, nullable=False) type_code: Mapped[str] = mapped_column(String(10)) description: Mapped[str] = mapped_column(String(255)) project_status: Mapped[str] = mapped_column(String(10)) user_id: Mapped[int] = mapped_column(Integer) train_version: Mapped[int] = mapped_column(Integer) class ProjectLabel(DbCommon): """项目标签表""" __tablename__ = "project_label" label_name: Mapped[str] = mapped_column(String(32), unique=True, nullable=False) project_id: Mapped[int] = mapped_column(Integer, nullable=False) meta: Mapped[dict] = mapped_column(JSON) class ProjectImage(DbCommon): """项目图片表""" __tablename__ = "project_image" image_url: Mapped[str] = mapped_column(String(255), nullable=False) thumb_image_url: Mapped[str] = mapped_column(String(255), nullable=False) project_id: Mapped[int] = mapped_column(Integer) class ProjectImgLeafer(DbCommon): """项目图片leafer表""" __tablename__ = "project_img_leafer" image_id: Mapped[int] = mapped_column(Integer, nullable=False) leafer: Mapped[dict] = mapped_column(JSON) class ProjectImgLabel(DbCommon): """项目图片标签对应表,一张图片对应多个label""" __tablename__ = "project_img_label" image_id: Mapped[int] = mapped_column(Integer, nullable=False) label_id: Mapped[int] = mapped_column(Integer, nullable=False) mark_center_x: Mapped[str] = mapped_column(String(64), nullable=False) mark_center_y: Mapped[str] = mapped_column(String(64), nullable=False) mark_width: Mapped[str] = mapped_column(String(64), nullable=False) mark_height: Mapped[str] = mapped_column(String(64), nullable=False) class ProjectTrain(DbCommon): """项目训练版本信息表""" __tablename__ = "project_train" project_id: Mapped[int] = mapped_column(Integer, nullable=False) train_version: Mapped[str] = mapped_column(String(32), nullable=False) best_pt: Mapped[str] = mapped_column(String(255), nullable=False) last_pt: Mapped[str] = mapped_column(String(255), nullable=False)