23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
"""顾问表(需求 2.1 学生表里的"顾问编号"指向它,也是第 5 节的扩展模块)。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy import String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.model.base import Base, SoftDeleteMixin, TimestampMixin
|
|
|
|
|
|
class Advisor(Base, TimestampMixin, SoftDeleteMixin):
|
|
__tablename__ = "advisor"
|
|
__table_args__ = {"comment": "顾问表"}
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
advisor_no: Mapped[str] = mapped_column(String(20), unique=True, nullable=False, comment="顾问编号")
|
|
name: Mapped[str] = mapped_column(String(30), nullable=False, index=True, comment="顾问姓名")
|
|
gender: Mapped[int] = mapped_column(default=1, nullable=False, comment="性别 1=男 2=女")
|
|
phone: Mapped[str | None] = mapped_column(String(20), comment="联系电话")
|
|
email: Mapped[str | None] = mapped_column(String(60), comment="邮箱")
|
|
dept: Mapped[str | None] = mapped_column(String(50), comment="所属部门")
|
|
remark: Mapped[str | None] = mapped_column(String(255), comment="备注")
|