修正注释信息
This commit is contained in:
+16
-12
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
|
||||
from fastapi import APIRouter,Depends,HTTPException
|
||||
from fastapi import APIRouter,Depends,HTTPException,Query
|
||||
from stu_jiuye.dao import *
|
||||
from stu_jiuye.request import PostRequest, EmpResponse, AddRequest,AddResponse,CompRequest,CompResponse
|
||||
from stu_jiuye.database import get_db
|
||||
@@ -9,14 +9,16 @@ CURD=APIRouter()
|
||||
|
||||
@CURD.get('/emp',summary='查询就业信息')
|
||||
def get_stuinfo( #查询学生就业信息
|
||||
sname:str| None = None
|
||||
,class_num:int| None = None
|
||||
,employment_company:str|None=None
|
||||
,min_salary:int=0
|
||||
,max_salary:int|None=None
|
||||
,somewhere:str|None=None
|
||||
,employment_open_time:datetime.date|None=None
|
||||
,offer_recived_time:datetime.date|None=None
|
||||
sname:str| None = Query(None,description='学生姓名')
|
||||
,class_num:int| None = Query(None,description='班级编号')
|
||||
,employment_company:str|None=Query(None,description='公司名称')
|
||||
,min_salary:int|None=Query(None,description='最小薪资范围')
|
||||
,max_salary:int|None=Query(None,description='最大薪资范围')
|
||||
,somewhere:str|None=Query(None,description='公司地区')
|
||||
,employment_open_start: datetime.date | None = Query(None,description='就业开放起始时间')
|
||||
,employment_open_end: datetime.date | None = Query(None,description='就业开放结束时间')
|
||||
,offer_recived_start: datetime.date | None = Query(None,description='offer下发起始时间')
|
||||
,offer_recived_end: datetime.date | None = Query(None,description='offer下发结束时间')
|
||||
,db=Depends(get_db)
|
||||
): #查询条件
|
||||
r=get_emp_dao( #调用函数
|
||||
@@ -26,8 +28,10 @@ def get_stuinfo( #查询学生就业信息
|
||||
min_salary,
|
||||
max_salary,
|
||||
somewhere,
|
||||
employment_open_time,
|
||||
offer_recived_time,
|
||||
employment_open_start,
|
||||
employment_open_end,
|
||||
offer_recived_start,
|
||||
offer_recived_end,
|
||||
db
|
||||
)
|
||||
if r:
|
||||
@@ -75,9 +79,9 @@ def updata_stuinfo( #更新数据模块
|
||||
d = up.model_dump(exclude_unset=True) #解析
|
||||
d.pop('create_time', None)
|
||||
d.pop('is_deleted', None)
|
||||
r = update_emp_dao(id=id, update_data=d, db=db) #调用更新函数
|
||||
if not d:
|
||||
raise HTTPException(status_code=400, detail='没有需要更新的字段')
|
||||
r = update_emp_dao(id=id, update_data=d, db=db) #调用更新函数
|
||||
if not r:
|
||||
raise HTTPException(status_code=404, detail='未找到对应记录') #失败返回错误信息
|
||||
return {'code': 200, 'totals': r, 'detail': '更新成功'} #成功返回信息
|
||||
|
||||
Reference in New Issue
Block a user