就业模块修改

This commit is contained in:
Corning Zhao
2026-09-14 12:12:29 +08:00
parent c392cd90e6
commit 71118806f1
4 changed files with 11 additions and 14 deletions
+3 -9
View File
@@ -17,18 +17,14 @@ class EmpDAO:
@staticmethod
def list_emps(db: Session, skip: int = 0, limit: int = 100, company_name: str = None):
"""查询就业列表,顺带把学生姓名带上"""
"""查询就业列表"""
q = db.query(Emp).filter(Emp.is_deleted == 0)
if company_name:
q = q.filter(Emp.company_name.like(f"%{company_name}%"))
emp_list = q.offset(skip).limit(limit).all()
for e in emp_list:
stu = db.query(Student).filter(
Student.stu_no == e.stu_no,
Student.is_deleted == 0,
).first()
e.stu_name = stu.stu_name if stu else None
e.stu_name = e.student.stu_name
return emp_list
@staticmethod
@@ -38,9 +34,7 @@ class EmpDAO:
Emp.stu_no == stu_no,
Emp.is_deleted == 0,
).first()
if emp:
stu = EmpDAO.get_student(db, stu_no)
emp.stu_name = stu.stu_name if stu else None
emp.stu_name =emp.student.stu_name
return emp
@staticmethod