2026-09-14 10:23:36 +08:00
|
|
|
from sqlalchemy import Column, Integer, Float, ForeignKey, String
|
2026-09-13 22:06:43 +08:00
|
|
|
from sqlalchemy.orm import relationship
|
|
|
|
|
|
2026-09-12 16:30:43 +08:00
|
|
|
from database import Base
|
2026-09-12 20:55:36 +08:00
|
|
|
|
|
|
|
|
class Score(Base):
|
2026-09-13 18:20:37 +08:00
|
|
|
__tablename__ = "wl_score"
|
2026-09-12 16:30:43 +08:00
|
|
|
|
2026-09-14 10:23:36 +08:00
|
|
|
# 和 wl_emp 一样:学号直接做主键,同时做外键指向学生表的业务学号,
|
|
|
|
|
# 不再用内部主键 stu_id。长度跟 Student.stu_no 保持一致。
|
|
|
|
|
stu_no = Column(String(20), ForeignKey('wl_student.stu_no'), primary_key=True, comment="学号")
|
2026-09-12 16:30:43 +08:00
|
|
|
exam_order = Column(Integer, primary_key=True, comment="考核序次")
|
|
|
|
|
score = Column(Float, nullable=False, comment="成绩")
|
|
|
|
|
|
2026-09-13 22:06:43 +08:00
|
|
|
student=relationship("Student",back_populates="scores")
|
|
|
|
|
|
2026-09-12 16:30:43 +08:00
|
|
|
|