Merge remote-tracking branch 'origin/conding' into conding
This commit is contained in:
@@ -7,15 +7,15 @@ from typing import Optional
|
||||
emp_api = APIRouter(tags=['学生就业管理模块'])
|
||||
|
||||
@emp_api.get('/employment/class/{class_id}',response_model=list[EmploymentResponse],summary='获取班级学生就业信息')
|
||||
def get_emp_info2(class_id: Optional[int]=Path(description='班级编号')
|
||||
def get_emp_info1(class_id: Optional[int]=Path(description='班级编号')
|
||||
,db=Depends(get_db)):
|
||||
e2 = employment_dao.get_emp_dao(class_id=class_id, db=db)
|
||||
if e2:
|
||||
return e2
|
||||
e1 = employment_dao.get_emp_dao(class_id=class_id, db=db)
|
||||
if e1:
|
||||
return e1
|
||||
raise HTTPException(status_code=404, detail='该班级就业信息不存在')
|
||||
|
||||
@emp_api.get('/employment/students/{stu_id}',response_model=list[EmploymentResponse],summary='按照学⽣编号,公司名字,⼯资范围查询学⽣就业信息')
|
||||
def get_emp_info3(stu_id:int = Path(description='学生编号')
|
||||
def get_emp_info2(stu_id:int = Path(description='学生编号')
|
||||
,company_name: str|None = Query(None,description='公司名称')
|
||||
,min_salary: float|None = Query(None,ge=0,description='最低工资')
|
||||
,max_salary: float|None = Query(None,ge=0,description='最高工资')
|
||||
|
||||
@@ -19,6 +19,13 @@ def get_grade(stu_id: int,db=Depends(get_db)):
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500,detail=f'数据库查询异常:{str(e)}')
|
||||
|
||||
@gradeAPI.delete('/{stu_id}',summary='删除成绩')
|
||||
def delete_grade(stu_id:int,db=Depends(get_db)):
|
||||
r = delete_grade_dao(stu_id=stu_id,db=db)
|
||||
if not r:
|
||||
raise HTTPException(status_code=404,detail='删除失败')
|
||||
return {'code':200,'totals':r,'detail':'删除成功'}
|
||||
|
||||
@gradeAPI.post('/grade',summary='添加学生成绩')
|
||||
def post_grade(o:GradeRequest,db=Depends(get_db)):
|
||||
d=o.model_dump()
|
||||
@@ -72,9 +79,3 @@ def put_grade(
|
||||
|
||||
return {"code": 200, "totals": rows, "detail": "更新成功"}
|
||||
|
||||
@gradeAPI.delete('/{score_id}',summary='删除成绩')
|
||||
def delete_grade(score_id:int,db=Depends(get_db)):
|
||||
r = delete_grade_dao(stu_id=score_id,db=db)
|
||||
if not r:
|
||||
raise HTTPException(status_code=404,detail='删除失败')
|
||||
return {'code':200,'totals':r,'detail':'删除成功'}
|
||||
@@ -19,14 +19,19 @@ def get_score_by_stu_exam_order_dao(stu_id:str,exam_order:int,db):
|
||||
|
||||
def get_grade_dao( stu_id:int , db):
|
||||
|
||||
r1 =(db.query( WlScore.score_id
|
||||
,WlScore.stu_id
|
||||
,Student_Model.stu_name
|
||||
,WlScore.exam_order
|
||||
,WlScore.score
|
||||
r1 =(db.query( WlScore.score_id
|
||||
,WlScore.stu_id
|
||||
,Student_Model.stu_name
|
||||
,WlScore.exam_order
|
||||
,WlScore.score
|
||||
,ClassManagement.class_name
|
||||
)
|
||||
.join(Student_Model,WlScore.stu_id == Student_Model.stu_id)
|
||||
.filter(WlScore.stu_id == stu_id,WlScore.delete_status == 0,Student_Model.delete_status == 0)
|
||||
.join( Student_Model,WlScore.stu_id == Student_Model.stu_id)
|
||||
.join(ClassManagement,Student_Model.class_id==ClassManagement.class_id)
|
||||
.filter( WlScore.stu_id == stu_id
|
||||
,WlScore.delete_status == 0
|
||||
,Student_Model.delete_status == 0
|
||||
,ClassManagement.delete_status == 0)
|
||||
.all())
|
||||
if r1:
|
||||
data_list = []
|
||||
@@ -36,7 +41,8 @@ def get_grade_dao( stu_id:int , db):
|
||||
"stu_id": row.stu_id,
|
||||
"stu_name": row.stu_name,
|
||||
"exam_order": row.exam_order,
|
||||
"score": row.score
|
||||
"score": row.score,
|
||||
"class_name": row.class_name,
|
||||
})
|
||||
return data_list
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user