nb
This commit is contained in:
@@ -7,11 +7,15 @@ from fastapi import APIRouter, Depends, HTTPException, Body
|
||||
|
||||
gradeAPI = APIRouter(tags=['学生考核成绩管理模块'])
|
||||
|
||||
@gradeAPI.get("/grade/{stu_id}",response_model=list[GradeResponse],summary="根据学生id查询成绩")
|
||||
@gradeAPI.get("/grade/{stu_id}",summary="根据学生id查询成绩")
|
||||
def get_grade(stu_id: int,db=Depends(get_db)):
|
||||
try:
|
||||
res=get_grade_dao(stu_id,db)
|
||||
return res
|
||||
return {
|
||||
"code": 200,
|
||||
"detail": "查询成功",
|
||||
"data": res
|
||||
}
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500,detail=f'数据库查询异常:{str(e)}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user