学生信息管理系统
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# 就业开放时间和offer下发时间校验
|
||||
# 导入基类、过滤条件、校验器
|
||||
from pydantic import BaseModel, Field, model_validator, field_validator
|
||||
# 导入时间模块
|
||||
from datetime import date, datetime
|
||||
# 导入可选类型、列表类型
|
||||
from typing import Optional, List
|
||||
|
||||
# ---------- 请求模型 ----------
|
||||
|
||||
# 修改就业记录
|
||||
class EmploymentOfferUpdate(BaseModel):
|
||||
offer_time: Optional[date] = None
|
||||
|
||||
|
||||
# 修改就业基础
|
||||
class EmploymentBaseUpdate(BaseModel):
|
||||
employment_open_time: Optional[date] = None
|
||||
job_time: Optional[date] = None
|
||||
company_name: Optional[str] = None
|
||||
salary: Optional[float] = None
|
||||
|
||||
# 添加就业基础
|
||||
class EmploymentBaseCreate(BaseModel):
|
||||
stu_id: int = Field(..., description="学生编号")
|
||||
job_time: Optional[date] = Field(None, description="实际去就职时间")
|
||||
employment_open_time: date = Field(description="就业开放时间:年-月-日")
|
||||
company_name: str = Field(max_length=100, description="就业公司")
|
||||
salary: float = Field(..., gt=0, description="就业薪资,保留2位小数")
|
||||
|
||||
# 添加就业记录
|
||||
class EmploymentOfferCreate(BaseModel):
|
||||
stu_id: int = Field(..., description="学生编号")
|
||||
offer_id: int = Field(..., description="offer编号")
|
||||
offer_time: date = Field(description="offer下发时间:年-月-日")
|
||||
|
||||
# 多条件组合查询
|
||||
class EmploymentQuery(BaseModel):
|
||||
stu_id: Optional[int] = None
|
||||
company_name: Optional[str] = Field(None, max_length=100, description="公司名称")
|
||||
min_salary: Optional[float] = None
|
||||
max_salary: Optional[float] = None
|
||||
|
||||
|
||||
# ---------- 响应模型 ----------
|
||||
# 就业记录查询响应
|
||||
class EmploymentOfferQueryResponse(BaseModel):
|
||||
stu_id: int
|
||||
offer_id: int
|
||||
offer_time: date
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
# 就业基础查询响应
|
||||
class EmploymentBaseQueryResponse(BaseModel):
|
||||
stu_id: int
|
||||
employment_open_time: Optional[date] = None
|
||||
job_time: Optional[date] = None
|
||||
company_name: Optional[str] = None
|
||||
salary: Optional[float] = None
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in New Issue
Block a user