This commit is contained in:
maruizhi
2026-09-22 22:41:22 +08:00
parent 9f87dd25d1
commit 9f0fae933f
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -31,13 +31,13 @@ def get_emp_info2(stu_id:int = Path(description='学生编号')
raise HTTPException(status_code=404,detail='该学生就业信息不存在!')
return l1
@emp_api.post('/employment/students/{stu_id}',response_model=EmploymentResponse,summary='新增学生就业信息')
@emp_api.post('/employment/student/{stu_id}',summary='新增学生就业信息')
def create_emp_info(emp:EmploymentRequest=Form(),db=Depends(get_db)):
d=emp.model_dump(exclude_unset=False)
r=add_emp_dao(d,db)
if not r:
raise HTTPException(status_code=500,detail='服务器繁忙,请稍后添加!')
return r
return {'code':200,'detail':'插入成功!'}
@emp_api.put('/employment/students/{emp_id}',summary='更新学生就业信息')
def update_emp_info(emp_id:int,emp:UpdateEmpRequest,db=Depends(get_db)):
+2 -2
View File
@@ -1,4 +1,4 @@
from fastapi import APIRouter,HTTPException,Depends,Query
from fastapi import APIRouter, HTTPException, Depends, Query, Path
from dao.student_dao import *
from schema.student_schema import *
from util.database import get_db
@@ -53,7 +53,7 @@ def update_students(stu_id:int
return {'code':200,'totals':r,'detail':'更新成功'}
@StudentAPI.delete('/students/{stu_id}',response_model= StudelResponse,summary='学生信息删除接口',description='删除学生信息')
def del_students(stu_id:int=Query(None,description='班级编号')
def del_students(stu_id:int= Path(description='班级编号')
,db=Depends(get_db)):
rows=delete_student_dao( stu_id=stu_id,db=db )
if not rows:
+1 -1
View File
@@ -49,7 +49,7 @@ def add_emp_dao(o,db):
e1 = Employment_info(**o)
db.add(e1)
db.commit()
return e1
return o
except Exception as e:
db.rollback()
raise HTTPException(status_code=500, detail=f'新增就业信息失败: {e}')