From cb5132c0b9ff874657e87299ddc10abd4317a259 Mon Sep 17 00:00:00 2001 From: wolin_chenyulin001 <123@163.com> Date: Tue, 22 Sep 2026 23:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9put=E5=92=8Cdelete=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=8F=82=E6=95=B0=E4=B8=BAstu=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PythonProject/api/employment_api.py | 12 ++++++++++-- PythonProject/schema/employment_schema.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/PythonProject/api/employment_api.py b/PythonProject/api/employment_api.py index a0ddef6..b500a44 100644 --- a/PythonProject/api/employment_api.py +++ b/PythonProject/api/employment_api.py @@ -6,6 +6,14 @@ from util.database import get_db from typing import Optional emp_api = APIRouter(tags=['学生就业管理模块']) +@emp_api.get('/employment/student/{stu_id}',response_model=list[EmploymentResponse],summary='获取学生就业信息') +def get_emp_info1(stu_id: Optional[int]=Path(description='学生编号') + ,db=Depends(get_db)): + e = employment_dao.get_emp_dao(stu_id=stu_id, db=db) + if e: + return e + raise HTTPException(status_code=404, detail='该学生就业信息不存在') + @emp_api.get('/employment/class/{class_id}',response_model=list[EmploymentResponse],summary='获取班级学生就业信息') def get_emp_info1(class_id: Optional[int]=Path(description='班级编号') ,db=Depends(get_db)): @@ -14,8 +22,8 @@ def get_emp_info1(class_id: Optional[int]=Path(description='班级编号') return e1 raise HTTPException(status_code=404, detail='该班级就业信息不存在') -@emp_api.get('/employment/students/{stu_id}',response_model=list[EmploymentResponse],summary='按照学⽣编号,公司名字,⼯资范围查询学⽣就业信息') -def get_emp_info2(stu_id:int = Path(description='学生编号') +@emp_api.get('/employment/students',response_model=list[EmploymentResponse],summary='按照学⽣编号,公司名字,⼯资范围查询学⽣就业信息') +def get_emp_info2(stu_id:int|None = Query(None,description='学生编号') ,company_name: str|None = Query(None,description='公司名称') ,min_salary: float|None = Query(None,ge=0,description='最低工资') ,max_salary: float|None = Query(None,ge=0,description='最高工资') diff --git a/PythonProject/schema/employment_schema.py b/PythonProject/schema/employment_schema.py index 1505868..f6062bd 100644 --- a/PythonProject/schema/employment_schema.py +++ b/PythonProject/schema/employment_schema.py @@ -3,7 +3,7 @@ from datetime import date from typing import Optional class EmploymentRequest(BaseModel): - stu_id: int=Field(ge=1,description='学生编号') + stu_id: int=Field(ge=1, description='学生编号') email: Optional[str] = Field(None, description='邮箱') employment_opening_date:Optional[date] = Field(None, description='就业开放日期') offer_issuance_date:Optional[date] = Field(None, description='offer下发日期')