15 lines
539 B
Python
15 lines
539 B
Python
from fastapi import APIRouter,Depends,HTTPException,Path
|
|
from util.database import get_db
|
|
from model.grade_model import *
|
|
from dao.grade_dao import *
|
|
|
|
gradeAPI = APIRouter(tags=['学生考核成绩'])
|
|
|
|
@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 {'code': 200,'msg':'查询成功','data':res}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500,detail=f'数据库查询异常:{str(e)}')
|