Compare commits

...
5 Commits
Author SHA1 Message Date
test1 acb4036589 马睿智牛逼! 2026-09-22 14:55:31 +08:00
test1 2a3d1be2e3 Merge remote-tracking branch 'origin/conding' into conding 2026-09-22 14:54:40 +08:00
test1 43c558d5bc 马睿智牛逼! 2026-09-22 14:54:25 +08:00
test1 d7083402aa Merge remote-tracking branch 'origin/conding' into conding
# Conflicts:
#	PythonProject/api/statistics_api.py
2026-09-22 14:51:10 +08:00
test1 e9086e842b 马睿智牛逼! 2026-09-22 14:50:43 +08:00
2 changed files with 28 additions and 1 deletions
+5
View File
@@ -40,3 +40,8 @@ def get_days(db=Depends(get_db)):
def get_emp(db=Depends(get_db)):
l= select_days(db)
return l
@StatisticsAPI.get('/salaries',summary='统计薪资分布')
def get_salaries(db=Depends(get_db)):
s=classify_salary(db)
return s
+23 -1
View File
@@ -131,4 +131,26 @@ def select_days(db):
).filter(Employment_info.delete_status == 0).all()
return l2
except Exception:
raise HTTPException(status_code=500, detail="查询异常")
raise HTTPException(status_code=500, detail="查询异常")
# 薪资区间分布:统计薪资在5k以下、5k-10k、10k-15k、15k以上的人数分布,反映学生的整体就业质量。
def classify_salary(db):
try:
a=b=c=d=0
l=db.query(Employment_info).filter(Employment_info.delete_status==0).all()
for i in l:
if i.salary is None:
continue
elif i.salary<5000:
a+=1
elif 5000<=i.salary<10000:
b+=1
elif 10000<=i.salary<15000:
c+=1
else:
d+=1
return {'5k以下': a, '5k-10k': b, '10k-15k': c, '15k': d}
except:
raise HTTPException(status_code=500,detail='查询异常!')