添加statistics tag

This commit is contained in:
2026-09-24 10:28:00 +08:00
parent a90c240b5a
commit e80d463bbc
+5 -4
View File
@@ -12,14 +12,13 @@ def create_score(req: ScoreCreate, db: Session = Depends(get_db)):
# 业务校验:联合唯一 # 业务校验:联合唯一
if exist_student_exam_dao(req.student_id, req.exam_seq, db): if exist_student_exam_dao(req.student_id, req.exam_seq, db):
raise HTTPException(status_code=400, detail="该学生本次考试成绩已存在,不能重复录入") raise HTTPException(status_code=400, detail="该学生本次考试成绩已存在,不能重复录入")
ok = post_score_dao(req.model_dump(), db) ok = post_score_dao(req.model_dump(), db)
if not ok: if not ok:
raise HTTPException(status_code=400, detail="新增成绩失败,请检查学生id是否存在") raise HTTPException(status_code=400, detail="新增成绩失败,请检查学生id是否存在")
return {"msg": "新增成功"} return {"msg": "新增成功"}
@scores_router.get("", response_model=ScorePageResp, summary="查询成绩接口") @scores_router.get("", response_model=ScorePageResp, summary="个人成绩查询接口")
def list_score( def list_score(
score_id: int|None=None, score_id: int|None=None,
student_id: int |None=None, student_id: int |None=None,
@@ -32,7 +31,9 @@ def list_score(
return {"total": total, "data": data_list} return {"total": total, "data": data_list}
@scores_router.put("/{score_id}", summary="更新成绩接口")
@scores_router.put("{score_id}", summary="更新成绩接口")
def modify_score(score_id: int, req: ScoreUpdate, db: Session = Depends(get_db)): def modify_score(score_id: int, req: ScoreUpdate, db: Session = Depends(get_db)):
update_dict = req.model_dump(exclude_unset=True) update_dict = req.model_dump(exclude_unset=True)
if not update_dict: if not update_dict:
@@ -43,7 +44,7 @@ def modify_score(score_id: int, req: ScoreUpdate, db: Session = Depends(get_db))
return {"msg": "修改成功"} return {"msg": "修改成功"}
@scores_router.delete("/{score_id}", summary="删除成绩接口") @scores_router.delete("{score_id}", summary="删除成绩接口")
def remove_score(score_id: int, db: Session = Depends(get_db)): def remove_score(score_id: int, db: Session = Depends(get_db)):
ok = delete_score_dao(score_id, db) ok = delete_score_dao(score_id, db)
if not ok: if not ok: