就业get次昂管的dao层和api接口
This commit is contained in:
@@ -2,7 +2,7 @@ from fastapi import HTTPException
|
||||
from model.all_model import Employment_info, ClassManagement, Student_Model
|
||||
|
||||
|
||||
def get_emp_dao(stu_id,class_id,db):
|
||||
def get_emp_dao(stu_id=None,class_id=None,company_name=None,min_salary=None,max_salary=None,db=None):
|
||||
try:
|
||||
q = db.query(Employment_info).\
|
||||
join(Student_Model,Employment_info.stu_id == Student_Model.stu_id).\
|
||||
@@ -10,11 +10,19 @@ def get_emp_dao(stu_id,class_id,db):
|
||||
filter(Employment_info.delete_status == 0).\
|
||||
filter(Student_Model.delete_status == 0).\
|
||||
filter(ClassManagement.delete_status == 0)
|
||||
if stu_id is not None:
|
||||
if stu_id:
|
||||
q = q.filter(Employment_info.stu_id == stu_id)
|
||||
if class_id is not None:
|
||||
if class_id:
|
||||
q = q.filter(ClassManagement.class_id == class_id)
|
||||
if company_name:
|
||||
q = q.filter(Employment_info.company_name == company_name)
|
||||
if min_salary:
|
||||
q = q.filter(Employment_info.salary >= min_salary)
|
||||
if max_salary:
|
||||
q = q.filter(Employment_info.salary <= max_salary)
|
||||
|
||||
r = q.all()
|
||||
|
||||
if r:
|
||||
return [{'emp_id':i.emp_id
|
||||
,'stu_id': i.stu_id
|
||||
@@ -45,9 +53,6 @@ def check_stu_dao(stu_id,db):
|
||||
stu = db.query(Student_Model).filter(Student_Model.stu_id == stu_id,Student_Model.delete_status == 0).first()
|
||||
return stu
|
||||
|
||||
# def check_emp_dao(stu_id=):
|
||||
|
||||
|
||||
def update_emp_dao(stu_id,o,db):
|
||||
try:
|
||||
rows = db.query(Employment_info).filter(Employment_info.stu_id == stu_id,Employment_info.delete_status == 0).first()
|
||||
|
||||
Reference in New Issue
Block a user