Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from datetime import date
|
||||
from typing import Optional, List
|
||||
|
||||
@@ -22,7 +22,7 @@ class StudentResp(StudentCreate):
|
||||
|
||||
# ----------------成绩----------------
|
||||
class ScoreCreate(BaseModel):
|
||||
stu_id: int
|
||||
stu_no: str
|
||||
exam_order: int
|
||||
score: float
|
||||
|
||||
@@ -30,6 +30,15 @@ class ScoreResp(ScoreCreate):
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
# 对外出参:成绩表现在直接用学号做主键,stu_no 就是表里的真实字段,
|
||||
# 查到 ORM 对象直接读出来即可,不需要额外挂展示字段。
|
||||
class ScoreOut(BaseModel):
|
||||
stu_no: str
|
||||
exam_order: int
|
||||
score: float
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
# ----------------班级----------------
|
||||
class ClassCreate(BaseModel):
|
||||
start_time: Optional[date] = None
|
||||
|
||||
@@ -8,7 +8,7 @@ from pydantic import BaseModel, ConfigDict
|
||||
from model.wl_score_model import Score
|
||||
|
||||
|
||||
# ---- 入参:动态查询的比较条件 ----
|
||||
|
||||
class AgeCompareOp(str, Enum):
|
||||
"""年龄比较条件:大于/大于等于/小于/小于等于/等于/区间"""
|
||||
gt = "gt"
|
||||
@@ -25,7 +25,7 @@ class SortOrder(str, Enum):
|
||||
desc = "desc"
|
||||
|
||||
|
||||
# ---- 出参:后续统计接口的聚合结果 DTO 放这里 ----
|
||||
|
||||
class ClassGenderStatOut(BaseModel):
|
||||
"""班级多维度统计:总人数 + 男女分布"""
|
||||
class_id: Optional[int] = None
|
||||
@@ -49,7 +49,7 @@ class FailCountModel(BaseModel):
|
||||
|
||||
class ClassAvgScoreOut(BaseModel):
|
||||
"""每次考试每个班级的平均分"""
|
||||
# DAO 返回的是 SQLAlchemy Row 对象,必须开 from_attributes 才能按属性名读取
|
||||
# DAO 返回的是 SQLAlchemy Row 对象,开 from_attributes 属性名读取
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
class_id:Optional[int]=None
|
||||
@@ -58,23 +58,24 @@ class ClassAvgScoreOut(BaseModel):
|
||||
|
||||
class EmpTopOut(BaseModel):
|
||||
"""就业薪资排名 Top N"""
|
||||
# 同样是 Row 对象,必须开 from_attributes
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
stu_name:Optional[str]=None
|
||||
class_id:Optional[int]=None
|
||||
offer_time:Optional[datetime]=None
|
||||
company_name:Optional[str]=None
|
||||
salary:Optional[int]=None
|
||||
|
||||
class ClassAvgEmpTimeOut(BaseModel):
|
||||
"""每个班级的平均就业时长"""
|
||||
class_id: Optional[int] = None
|
||||
# 单位:天,保留 1 位小数;为 None 表示该班无就业学生,前端展示"无就业学生"
|
||||
# 单位:天,保留 1 位小数;为 None 表示该班无就业学生
|
||||
avg_emp_time: Optional[float] = None
|
||||
# 参与统计的人数(平均值的分母),为 0 同样表示该班无就业学生
|
||||
# 参与统计的人数,为 0 表示该班无就业学生
|
||||
emp_stu_count: int = 0
|
||||
|
||||
class EmpTimeOut(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
stu_name:str=''
|
||||
emp_total_time:int=0 # 单位为天
|
||||
emp_total_time:int|str=""# 单位为天,""表示没有开放简历或者没有拿到offer
|
||||
|
||||
Reference in New Issue
Block a user