统计分析模块更新,待测试,优化所有模块main.py文件,修复bug。
This commit is contained in:
@@ -35,7 +35,7 @@ def get_students(g:get_student_dao = Depends()
|
||||
,description=f'查询每次考试成绩都在80分以上的学生的编号,姓名和成绩。'
|
||||
)
|
||||
def get_students(db=Depends(get_db)):
|
||||
result = get_student_dao( db=db )
|
||||
result = get_score_80( db=db )
|
||||
if result:
|
||||
return result
|
||||
raise HTTPException(status_code=404, detail="没有找到符合条件的学生")
|
||||
|
||||
@@ -39,9 +39,11 @@ def get_class_count(g , db):
|
||||
from scores.model.score_model import Score
|
||||
|
||||
def get_score_80(db):
|
||||
q = (db.query(Score)
|
||||
.filter(Score.score>=80)
|
||||
.all())
|
||||
q = ( db.query(Score)
|
||||
.group_by(Score.score)
|
||||
.having( min(Score.score) >= 80)
|
||||
.all()
|
||||
)
|
||||
return q
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from fastapi import FastAPI,APIRouter
|
||||
from StatCalc.api.statcalc_api import statcalc_api
|
||||
from databases import *
|
||||
from StatCalc.model import statcalc_model
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
StatCalc_API = APIRouter()
|
||||
|
||||
+2
-2
@@ -11,9 +11,9 @@ Teachers_API.include_router(tea_api)
|
||||
app = FastAPI()
|
||||
app.include_router(tea_api,tags=["老师"])
|
||||
|
||||
Base.metadata.create_all(engine1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
Base.metadata.create_all(engine1)
|
||||
|
||||
import uvicorn
|
||||
uvicorn.run('main:app', host='0.0.0.0', port=57000)
|
||||
"""
|
||||
|
||||
@@ -12,8 +12,6 @@ app = FastAPI()
|
||||
|
||||
app.include_router(class_api)
|
||||
|
||||
|
||||
|
||||
if __name__ =='__main__':
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@ app.include_router(Teachers_API,tags=["teachers"])
|
||||
# app.include_router(StatCalc_API,tags=["StatCalc"])
|
||||
|
||||
|
||||
Base_all.metadata.create_all(bind=engine_all)
|
||||
|
||||
if __name__ == "__main__":
|
||||
Base_all.metadata.create_all(bind=engine_all)
|
||||
|
||||
def main():
|
||||
print("Hello from student-manage-system!")
|
||||
|
||||
|
||||
+6
-4
@@ -6,12 +6,14 @@ from scores.database import engine,Base
|
||||
Scores_API = APIRouter()
|
||||
Scores_API.include_router(score_api)
|
||||
|
||||
# 自测接口
|
||||
app = FastAPI(tags=['成绩'],title='成绩管理系统')
|
||||
app.include_router(score_api)
|
||||
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 自测接口
|
||||
app = FastAPI(tags=['成绩'], title='成绩管理系统')
|
||||
app.include_router(score_api)
|
||||
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
import uvicorn
|
||||
uvicorn.run('main:app',host='127.0.0.1',port=12346)
|
||||
+3
-2
@@ -11,12 +11,13 @@ Shtudent_Jiuye.include_router(CURD)
|
||||
|
||||
|
||||
app=FastAPI()
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
app.include_router(CURD,tags=['就业管理系统'])
|
||||
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
import uvicorn
|
||||
uvicorn.run('main:app', host='127.0.0.1', port=12395)
|
||||
|
||||
|
||||
+11
-10
@@ -8,18 +8,19 @@ from contextlib import asynccontextmanager
|
||||
Students_API = APIRouter()
|
||||
Students_API.include_router(s_api)
|
||||
|
||||
# 自测接口
|
||||
@asynccontextmanager
|
||||
async def S_Fastapi(app: FastAPI):
|
||||
Base.metadata.create_all(engine1)
|
||||
yield
|
||||
engine1.dispose()
|
||||
|
||||
app = FastAPI(title="学生管理系统",lifespan=S_Fastapi) # 这里必须把上面写的加上
|
||||
app.include_router(s_api,tags=["students"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 自测接口
|
||||
@asynccontextmanager
|
||||
async def S_Fastapi(app: FastAPI):
|
||||
Base.metadata.create_all(engine1)
|
||||
yield
|
||||
engine1.dispose()
|
||||
|
||||
|
||||
app = FastAPI(title="学生管理系统", lifespan=S_Fastapi) # 这里必须把上面写的加上
|
||||
app.include_router(s_api, tags=["students"])
|
||||
|
||||
def main():
|
||||
print("Hello from student-manage-system!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user