Files
1/model/wl_student_model.py
T

32 lines
1.7 KiB
Python
Raw Normal View History

2026-09-21 20:16:09 +08:00
#学生基本信息 周学灵
from database import Base
from sqlalchemy import Column, Integer, String, Date, ForeignKey
from sqlalchemy.orm import relationship
class Student(Base):
__tablename__ = 'wl_student'
# ---------- 内部主键(隐藏,不对外)----------
stu_id = Column(Integer, primary_key=True, autoincrement=True, comment='内部主键')
# ---------- 业务学号(对外,按规则生成)----------
stu_no = Column(String(20), unique=True, nullable=False, index=True, comment='学号')
class_id = Column(Integer, ForeignKey('class_info.class_id'), nullable=True, comment='班级ID')
stu_name = Column(String(30), nullable=True, comment='学生姓名')
native_place = Column(String(50), nullable=True, comment='籍贯')
graduate_school=Column(String(128), nullable=True, comment='毕业学校')
major= Column(String(64), nullable=True, comment='专业')
in_time= Column(Date, nullable=True, comment='入学时间')
out_time= Column(Date, nullable=True, comment='毕业时间')
edu= Column(String(32), nullable=True, comment='学历')
advisor_id = Column(Integer, ForeignKey('advisor.adv_id'), nullable=True, comment='顾问ID')
stu_age = Column(Integer, nullable=True, comment='年龄')
stu_gender = Column(String(8), nullable=True, comment='性别')
class_ = relationship("Class_", back_populates="students")
scores=relationship("Score",back_populates="student")
emp = relationship("Emp", back_populates="student")
# advisor = relationship("Advisor", back_populates="students")
is_deleted = Column(Integer, default=0, comment='逻辑删除: 0正常 1删除')
def __repr__(self):
return f"<Student(id={self.stu_id}, name='{self.stu_name}')>"