Files
SST/PythonProject/api/employment_api.py
T

26 lines
1.2 KiB
Python
Raw Normal View History

2026-09-21 18:02:12 +08:00
from fastapi import APIRouter,Depends,HTTPException
2026-09-21 16:48:27 +08:00
from dao import employment_dao
from dao.employment_dao import get_employment_dao
2026-09-21 20:18:52 +08:00
from schema.employment_schema import EmploymentResponse
2026-09-21 16:48:27 +08:00
from model.all_model import ClassManagement,Employment_info
from util.database import get_db
2026-09-21 20:18:52 +08:00
emp_api = APIRouter(tags=['学生就业管理系统'])
@emp_api.get('/employment/students/{stu_id}',response_model=EmploymentResponse,summary='获取学生就业信息')
2026-09-21 16:48:27 +08:00
def get_emp_info1(stu_id: int,db=Depends(get_db)):
2026-09-21 20:18:52 +08:00
if stu_id:
return employment_dao.get_employment_dao(stu_id=stu_id,db=db)
raise HTTPException(status_code=404, detail='该学生就业信息不存在')
2026-09-21 16:48:27 +08:00
2026-09-21 20:18:52 +08:00
@emp_api.get('/employment/class/{class_id}',response_model=EmploymentResponse,summary='获取班级学生就业信息')
2026-09-21 16:48:27 +08:00
def get_emp_info2(class_id: int,db=Depends(get_db)):
2026-09-21 20:18:52 +08:00
if class_id:
return employment_dao.get_employment_dao(class_id=class_id,db=db)
raise HTTPException(status_code=404, detail='该班级就业信息不存在')
2026-09-21 16:48:27 +08:00
2026-09-21 20:18:52 +08:00
# @emp_api.post('/employment/students/{stu_id}')
# def create_emp_info(stu_id: int,db=Depends(get_db),response_model=EmploymentResponse):
# if stu_id:
#
# return employment_dao.