nb
This commit is contained in:
@@ -9,6 +9,7 @@ def get_grade_dao( stu_id:int , db):
|
||||
|
||||
r1 =db.query(WlScore).filter(WlScore.stu_id == stu_id,WlScore.delete_status == 0).all()
|
||||
if r1:
|
||||
|
||||
return r1
|
||||
else:
|
||||
raise HTTPException(status_code=404,detail="学生不存在")
|
||||
@@ -21,15 +22,15 @@ def add_grade_dao(g,db):
|
||||
return o1
|
||||
except Exception:
|
||||
db.rollback()
|
||||
return None
|
||||
raise HTTPException(status_code=500,detail="学生添加失败")
|
||||
|
||||
def update_grade_dao(score_id:int, update_data, db):
|
||||
try:
|
||||
rows = db.query(WlScore).filter(
|
||||
WlScore.stu_id == score_id,
|
||||
WlScore.score_id == score_id,
|
||||
WlScore.delete_status == 0
|
||||
).update(update_data)
|
||||
except:
|
||||
except Exception:
|
||||
db.rollback()
|
||||
return False
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user