Files
1/model/wl_score_model.py
2026-09-14 10:23:36 +08:00

18 lines
661 B
Python

from sqlalchemy import Column, Integer, Float, ForeignKey, String
from sqlalchemy.orm import relationship
from database import Base
class Score(Base):
__tablename__ = "wl_score"
# 和 wl_emp 一样:学号直接做主键,同时做外键指向学生表的业务学号,
# 不再用内部主键 stu_id。长度跟 Student.stu_no 保持一致。
stu_no = Column(String(20), ForeignKey('wl_student.stu_no'), primary_key=True, comment="学号")
exam_order = Column(Integer, primary_key=True, comment="考核序次")
score = Column(Float, nullable=False, comment="成绩")
student=relationship("Student",back_populates="scores")