Merge remote-tracking branch 'origin/conding' into conding
# Conflicts: # PythonProject/api/student_api.py # PythonProject/dao/statistics_dao.py
This commit is contained in:
@@ -6,7 +6,7 @@ from util.database import get_db
|
||||
|
||||
StudentAPI = APIRouter()
|
||||
|
||||
@StudentAPI.get('/',response_model=list[StudentPageResponse],description='查询学生信息')
|
||||
@StudentAPI.get('/',response_model=list[StudentPageResponse],tags=['学⽣基本信息管理模块'],description='查询学生信息')
|
||||
def get_students(stu_id:int|None=None
|
||||
,stu_name:str|None=None
|
||||
,class_id:int|None=None
|
||||
@@ -29,7 +29,7 @@ def get_students(stu_id:int|None=None
|
||||
, 'total': total
|
||||
, 'data': r}
|
||||
|
||||
@StudentAPI.put('/{stu_id}')
|
||||
@StudentAPI.put('/{stu_id}',tags=['学⽣基本信息管理模块'])
|
||||
def update_students(s:StudentRequest
|
||||
,stu_id:int
|
||||
,db=Depends(get_db)):
|
||||
@@ -41,7 +41,7 @@ def update_students(s:StudentRequest
|
||||
raise HTTPException(status_code=500, detail='没有更新!')
|
||||
return {'code':200,'totals':r,'detail':'更新成功'}
|
||||
|
||||
@StudentAPI.delete('/{stu_id}')
|
||||
@StudentAPI.delete('/{stu_id}',tags=['学⽣基本信息管理模块'])
|
||||
def del_students(stu_id:int
|
||||
,db=Depends(get_db)):
|
||||
rows=delete_student_dao( stu_id=stu_id,db=db )
|
||||
@@ -49,7 +49,7 @@ def del_students(stu_id:int
|
||||
raise HTTPException(status_code=500,detail='没有删除')
|
||||
return {'code':200,'totals':rows,'detail':'删除成功'}
|
||||
|
||||
@StudentAPI.post('/',response_model=StugetResponse,description='新增学生')
|
||||
@StudentAPI.post('/',tags=['学⽣基本信息管理模块'],response_model=StugetResponse)
|
||||
def add_students(s:StudentRequest
|
||||
,db=Depends(get_db)):
|
||||
d=s.model_dump(exclude_unset=False)
|
||||
@@ -59,3 +59,14 @@ def add_students(s:StudentRequest
|
||||
return stu_new
|
||||
|
||||
|
||||
@StudentAPI.put('/',tags=['学⽣基本信息管理模块'])
|
||||
def get_students(stu_id:int|None = None
|
||||
,stu_name:str|None = None
|
||||
,class_id:int|None=None
|
||||
,db=Depends(get_db)
|
||||
,page:int=1
|
||||
,page_size:int=10):
|
||||
r = get_student_dao(stu_id,stu_name,class_id,db,page,page_size )
|
||||
if r:
|
||||
return r
|
||||
raise HTTPException(status_code=404,detail='学生不存在!')
|
||||
|
||||
Reference in New Issue
Block a user