就业模块修改
This commit is contained in:
+3
-9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user