# model/students.py # 学生表:在建表语句基础上补充 status 字段(需求 2.1 可选字段 + 就业模块状态联动依赖它) from sqlalchemy import Column, Integer, String, Date, ForeignKey from sqlalchemy.orm import relationship from database import Base class Student(Base): __tablename__ = "student" stu_id = Column(Integer, primary_key=True, comment="学号(支持按规则自动生成)") stu_name = Column(String(10), nullable=False, comment="学生姓名") native_place = Column(String(30), nullable=False, comment="籍贯") graduate_school = Column(String(50), nullable=False, comment="毕业院校") major = Column(String(20), nullable=False, comment="专业") enroll_time = Column(Date, nullable=False, comment="入学时间") graduate_time = Column(Date, nullable=False, comment="毕业时间") education = Column(String(10), nullable=False, comment="学历:大专/本科/硕士等") age = Column(Integer, nullable=False, comment="年龄") gender = Column(String(10), nullable=False, comment="性别:男/女") class_id = Column(Integer, ForeignKey("c_lass.class_id"), nullable=False, comment="所属班级") advisor_id = Column(Integer, ForeignKey("advisor.advisor_id"), nullable=False, comment="顾问编号") status = Column(String(10), default="在读", nullable=False, comment="状态:在读/进入就业/已就业") is_deleted = Column(Integer, default=0, nullable=False, comment="逻辑删除: 0正常 1删除") # 关联关系 classes = relationship("Classinfo", back_populates="students") advisor = relationship("Advisor") scores = relationship("Score", back_populates="student") employment = relationship("EmploymentBase", back_populates="student", uselist=False) def __repr__(self): return f""