mrz
This commit is contained in:
@@ -2,7 +2,7 @@ from fastapi import HTTPException
|
||||
from model.all_model import Employment_info, ClassManagement, Student_Model
|
||||
from datetime import datetime
|
||||
|
||||
def get_emp_dao(stu_id=None,class_id=None,company_name=None,min_salary=None,max_salary=None,db=None):
|
||||
def get_emp_dao(db,stu_id=None,class_id=None,company_name=None,min_salary=None,max_salary=None):
|
||||
q = db.query(Employment_info.emp_id
|
||||
,Employment_info.stu_id
|
||||
,Student_Model.stu_name
|
||||
@@ -33,24 +33,11 @@ def get_emp_dao(stu_id=None,class_id=None,company_name=None,min_salary=None,max_
|
||||
r = q.all()
|
||||
if not r:
|
||||
raise HTTPException(status_code=500,detail='查询异常,没有结果!')
|
||||
return [
|
||||
{'emp_id':i.emp_id
|
||||
,'stu_id': i.stu_id
|
||||
,'stu_name':i.stu_name
|
||||
,'class_id':i.class_id
|
||||
,'email':i.email
|
||||
,'employment_opening_date':i.employment_opening_date
|
||||
,'offer_issuance_date':i.offer_issuance_date
|
||||
,'company_name':i.company_name
|
||||
,'company_address':i.company_address
|
||||
,'salary':i.salary
|
||||
}
|
||||
for i in r
|
||||
]
|
||||
return r
|
||||
|
||||
|
||||
|
||||
def add_emp_dao(o:dict,db):
|
||||
def add_emp_dao(o,db):
|
||||
try:
|
||||
stu = db.query(Student_Model).filter(Student_Model.stu_id == o['stu_id']
|
||||
, Student_Model.delete_status == 0).first()
|
||||
@@ -70,11 +57,11 @@ def add_emp_dao(o:dict,db):
|
||||
db.rollback()
|
||||
raise HTTPException(status_code=500, detail=f'新增就业信息失败: {e}')
|
||||
|
||||
def update_emp_dao(emp_id:int,db):
|
||||
def update_emp_dao(emp_id,emp,db):
|
||||
try:
|
||||
rows = db.query(Employment_info).filter(Employment_info.emp_id == emp_id
|
||||
,Employment_info.delete_status == 0).first()
|
||||
|
||||
rows = db.query(Employment_info)\
|
||||
.filter(Employment_info.emp_id == emp_id,Employment_info.delete_status == 0)\
|
||||
.update(emp)
|
||||
db.commit()
|
||||
return rows
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user