合并统计,学生,老师,成绩,班级模块,还差顾问,就业

This commit is contained in:
pzc
2026-09-13 22:06:43 +08:00
parent dd550edfd2
commit 5156da5a7c
9 changed files with 437 additions and 10 deletions
+4
View File
@@ -1,4 +1,6 @@
from sqlalchemy import Column, Integer, Date, String
from sqlalchemy.orm import relationship
from database import Base
class Class_(Base):
@@ -6,5 +8,7 @@ class Class_(Base):
class_id = Column(Integer, primary_key=True, autoincrement=True, comment="班级编号")
start_time = Column(Date, comment="开课时间")
students=relationship("Student", back_populates="class_")
# 逻辑删除标记(0代表正常,1代表已删除)
is_deleted = Column(Integer, default=0, comment="逻辑删除标记")
+5 -3
View File
@@ -1,18 +1,20 @@
from sqlalchemy import *
from sqlalchemy.orm import *
from database import Base
class Emp(Base):
__tablename__ = "wl_emp"
stu_id = Column(Integer, primary_key=True, autoincrement=True)
stu_id = Column(Integer,ForeignKey('wl_student.stu_id'), primary_key=True, autoincrement=True)
emp_open_time = Column(DateTime, default="2026-11-30 18:18:18")
offer_time = Column(DateTime, default=func.now())
company_name = Column(String(100), nullable=False)
salary = Column(Integer, nullable=False, default=15000)
student = relationship("wl_student", back_populates="wl_emp")
# Student.emp 用的是 back_populates="student",这个反向属性必须保留,否则 mapper 配置失败
student = relationship("Student", back_populates="emp")
def __repr__(self):
pass
+6 -2
View File
@@ -1,11 +1,15 @@
from sqlalchemy import Column, Integer, Float
from sqlalchemy import Column, Integer, Float, ForeignKey
from sqlalchemy.orm import relationship
from database import Base
class Score(Base):
__tablename__ = "wl_score"
stu_id = Column(Integer, primary_key=True, comment="学生编号")
stu_id = Column(Integer, ForeignKey('wl_student.stu_id'),primary_key=True, comment="学生编号")
exam_order = Column(Integer, primary_key=True, comment="考核序次")
score = Column(Float, nullable=False, comment="成绩")
student=relationship("Student",back_populates="scores")
+3 -1
View File
@@ -22,7 +22,9 @@ class Student(Base):
stu_age = Column(Integer, nullable=True, comment='年龄')
stu_gender = Column(String(8), nullable=True, comment='性别')
# class_ = relationship("Class", back_populates="students")
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删除')