Files
DoubaoTeam/models/class_teacher.py
T

54 lines
1.4 KiB
Python
Raw Normal View History

2026-09-21 15:06:09 +08:00
from sqlalchemy import (Column, Integer, String, Text,
2026-09-21 19:59:58 +08:00
BigInteger,ForeignKey,VARCHAR,DateTime
2026-09-21 15:06:09 +08:00
)
2026-09-21 19:59:58 +08:00
from sqlalchemy.dialects.mssql import TINYINT
2026-09-21 15:06:09 +08:00
from core.database import Base
from datetime import datetime
2026-09-21 19:59:58 +08:00
#班级老师关系表 class_teachers_info_detail 中间表 ORM 模型完整定义
2026-09-21 15:06:09 +08:00
#字段包括id,class_id,teacher_id,role,created_at,updated_at,is_deleted
class ClassTeachers(Base):
2026-09-21 19:59:58 +08:00
__tablename__ = "class_teachers_info_detail"
2026-09-21 15:06:09 +08:00
id = Column(
2026-09-21 19:59:58 +08:00
Integer
2026-09-21 15:06:09 +08:00
,primary_key=True
,autoincrement=True
,comment='关系')
class_id = Column(
2026-09-21 19:55:51 +08:00
Integer
2026-09-21 19:59:58 +08:00
,ForeignKey('class_info_detail.id')
2026-09-21 15:06:09 +08:00
,nullable=False
2026-09-21 19:59:58 +08:00
,comment='关联 class_id'
2026-09-21 15:06:09 +08:00
)
teacher_id = Column(
2026-09-21 19:55:51 +08:00
Integer
2026-09-21 19:59:58 +08:00
,ForeignKey("teacher_info_detail.id")
2026-09-21 15:06:09 +08:00
,nullable=False
2026-09-21 19:59:58 +08:00
,comment='关联 teacher_id'
2026-09-21 15:06:09 +08:00
)
role = Column(
VARCHAR(30)
,nullable=False
,comment='老师在班级中的角色:head_teacher班主任 / lecturer授课老师 / assistant助教'
)
created_at = Column(
DateTime
,nullable=False
2026-09-21 19:59:58 +08:00
,default=datetime.now()
2026-09-21 15:06:09 +08:00
,comment='创建时间'
)
updated_at = Column(
DateTime
,nullable=False
2026-09-21 19:59:58 +08:00
,default=datetime.now()
2026-09-21 15:06:09 +08:00
,comment='更新时间'
)
is_deleted = Column(
TINYINT
,nullable=False
,default=0
,comment='逻辑删除'
2026-09-21 19:55:51 +08:00
)