统计分析模块更新,待测试,成绩模块更新。
This commit is contained in:
@@ -12,11 +12,8 @@ statcalc_api = APIRouter()
|
||||
,summary='人员信息查询'
|
||||
,description=f'查询所有超过30岁的学员的信息。'
|
||||
)
|
||||
def get_students( stu:StudentsQuery = Depends()
|
||||
, db=Depends(get_db)
|
||||
):
|
||||
s_dict = stu.model_dump(exclude_unset=True) # 没值的不要
|
||||
result = get_student_dao( s=s_dict , db=db )
|
||||
def get_students(db=Depends(get_db)):
|
||||
result = get_age_30( db=db )
|
||||
if result:
|
||||
return result
|
||||
raise HTTPException(status_code=404, detail="没有找到符合条件的学生")
|
||||
@@ -25,9 +22,7 @@ def get_students( stu:StudentsQuery = Depends()
|
||||
,summary='人数统计'
|
||||
,description=f'统计每个班级的人数以及男生女生的人数。'
|
||||
)
|
||||
def get_students( stu:StudentsQuery = Depends()
|
||||
, db=Depends(get_db)
|
||||
):
|
||||
def get_students(db=Depends(get_db)):
|
||||
s_dict = stu.model_dump(exclude_unset=True) # 没值的不要
|
||||
result = get_student_dao( s=s_dict , db=db )
|
||||
if result:
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
# from StatCalc.model.statcalc_model import
|
||||
from StatCalc.schema.statcalc_request import *
|
||||
from fastapi import HTTPException
|
||||
|
||||
from students.model.students_model import Students
|
||||
|
||||
def get_age_30(db):
|
||||
q = db.query(Students).filter(Students.age>=30).all()
|
||||
return q
|
||||
|
||||
from class_management.model.class_management_model import ClassInfo
|
||||
|
||||
def get_class_count(db):
|
||||
q = (db.query(ClassInfo.id)
|
||||
.join(Students,Students.class_id==ClassInfo.id)
|
||||
.filter()
|
||||
.group_by(ClassInfo.id,Students.sex,)
|
||||
.all())
|
||||
return q
|
||||
Reference in New Issue
Block a user