28 lines
715 B
Python
28 lines
715 B
Python
"""
|
|
backend/app/models/department.py
|
|
|
|
用途:部门组织模型。
|
|
依赖:models.base.Base。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from sqlalchemy import String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base
|
|
|
|
|
|
class Department(Base):
|
|
"""部门表:存储公司部门列表。"""
|
|
|
|
__tablename__ = 'departments'
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
name: Mapped[str] = mapped_column(String(100), unique=True)
|
|
code: Mapped[Optional[str]] = mapped_column(String(50), unique=True)
|
|
company: Mapped[Optional[str]] = mapped_column(String(100))
|
|
description: Mapped[Optional[str]] = mapped_column(Text)
|