75 lines
2.7 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 sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import String, Integer, JSON
from db.db_base import BaseModel
class ProjectInfo(BaseModel):
"""
项目信息表
"""
__tablename__ = "project_info"
__table_args__ = ({'comment': '项目类别表 - 标识项目的类型目前存在的目标识别OCR识别瑕疵检测图像分类'})
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)
dept_id: Mapped[int] = mapped_column(Integer)
train_version: Mapped[int] = mapped_column(Integer)
class ProjectLabel(BaseModel):
"""
项目标签表
"""
__tablename__ = "project_label"
__table_args__ = ({'comment': '项目标签表'})
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(BaseModel):
"""
项目图片表
"""
__tablename__ = "project_image"
__table_args__ = ({'comment': '项目图片表'})
img_type: Mapped[str] = mapped_column(String(10))
file_name: Mapped[str] = mapped_column(String(64), nullable=False)
image_url: Mapped[str] = mapped_column(String(255), nullable=False)
object_key: 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(BaseModel):
"""
项目图片leafer表
"""
__tablename__ = "project_img_leafer"
__table_args__ = ({'comment': '项目图片leafer表'})
image_id: Mapped[int] = mapped_column(Integer, nullable=False)
leafer: Mapped[dict] = mapped_column(JSON)
class ProjectImgLabel(BaseModel):
"""
项目图片标签对应表一张图片对应多个label
"""
__tablename__ = "project_img_label"
__table_args__ = ({'comment': '项目图片标签对应表一张图片对应多个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)