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