第二版_完整
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
# import data
|
||||
from h11 import Data
|
||||
from pydantic import BaseModel, Field, ConfigDict,EmailStr
|
||||
from datetime import datetime, date
|
||||
from typing import Optional
|
||||
|
||||
# ---------- 请求模型 ----------
|
||||
class ClsMgmtCreate(BaseModel):
|
||||
# id: str = Field(..., min_length=3, max_length=50)
|
||||
cls_start_date: date=Field(...,description="开课时间,年-月-日")
|
||||
head_tea_id: str=Field(...,description="班主任工号,例:t001")
|
||||
lecturer_id: str = Field(..., description="班主任工号,例:t001")
|
||||
|
||||
class ClsMgmtUpdate(BaseModel):
|
||||
# id: str = Field(..., min_length=3, max_length=50)
|
||||
# cls_start_date: Data=Field(...,description="开课时间,年-月-日")
|
||||
head_tea_id: str=Field(...,description="班主任工号,例:t001")
|
||||
lecturer_id: str = Field(..., description="班主任工号,例:t001")
|
||||
|
||||
# ---------- 响应模型 ----------
|
||||
class ClsMgmtResponse(BaseModel):
|
||||
id: str
|
||||
cls_start_date: date
|
||||
head_tea_id: str
|
||||
lecturer_id: str
|
||||
class Config:
|
||||
from_attributes = True # 支持 ORM 对象转换
|
||||
|
||||
|
||||
|
||||
# model_config = ConfigDict(from_attributes=True)
|
||||
# class Config:
|
||||
# orm_mode = True
|
||||
# created_at: datetime
|
||||
# updated_at: Optional[datetime]
|
||||
#
|
||||
@@ -0,0 +1,69 @@
|
||||
# scheme/statistics_scheme.py
|
||||
from pydantic import BaseModel, Field, EmailStr
|
||||
from datetime import datetime, date
|
||||
from typing import Optional, List
|
||||
|
||||
|
||||
# ---------- 请求模型 ----------
|
||||
class StatsScoreRequest(BaseModel):
|
||||
choose: int = Field(..., ge=0, le=3)
|
||||
|
||||
email: EmailStr
|
||||
full_name: Optional[str] = Field(None, max_length=100)
|
||||
|
||||
# ---------- 响应模型 ----------
|
||||
# 多维度班级统计
|
||||
class StatsResponse(BaseModel):
|
||||
cls_id: str
|
||||
total_cnt: int
|
||||
man_cnt: int
|
||||
female_cnt: int
|
||||
|
||||
class ExamScoreItem(BaseModel):
|
||||
exam_attempt: int
|
||||
exam_score: float
|
||||
|
||||
# 查询每次考试成绩都在输入分数线(如80分)以上的学生的编号、姓名和成绩。
|
||||
class StuInfoAllExamAboveScore(BaseModel):
|
||||
stu_id: str
|
||||
stu_name: str
|
||||
stu_score: List[ExamScoreItem]
|
||||
|
||||
# 查询有输入指定次数(如两次)以上不及格的学生的姓名、班级和不及格成绩明细。
|
||||
class FailingStudentItem(BaseModel):
|
||||
stu_name: str
|
||||
stu_cls_id: str
|
||||
stu_fail_cnt: int
|
||||
stu_score: List[ExamScoreItem]
|
||||
|
||||
# 查询有输入指定次数(如两次)以上不及格的学生的姓名、班级和不及格成绩明细。
|
||||
class ClassExamAvgScoreItem(BaseModel):
|
||||
exam_attempt: int
|
||||
cls_id: str
|
||||
avg_score: float
|
||||
stu_cnt: int
|
||||
|
||||
class TopSalaryStudentItem(BaseModel):
|
||||
stu_name: str
|
||||
cls_id: str
|
||||
offer_time: date
|
||||
emp_company_name: str
|
||||
salary: float
|
||||
|
||||
class StudentEmpDurationItem(BaseModel):
|
||||
stu_id: str
|
||||
stu_name: str
|
||||
cls_id: str
|
||||
offer_time: int
|
||||
|
||||
class ClassAvgEmpDurationItem(BaseModel):
|
||||
cls_id: str
|
||||
avg_duration_days: float
|
||||
employed_cnt: int
|
||||
|
||||
class StudentAgeDetailItem(BaseModel):
|
||||
stu_id: str
|
||||
stu_name: str
|
||||
cls_id: str
|
||||
gender: str
|
||||
age: int
|
||||
Reference in New Issue
Block a user