Compare commits
3
Commits
de67f868cb
...
30ae0af56e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30ae0af56e | ||
|
|
5b10d0e868 | ||
|
|
6ff3d5974d |
@@ -178,7 +178,7 @@ def classify_salary(db):
|
||||
c+=1
|
||||
else:
|
||||
d+=1
|
||||
return {'5k以下': a, '5k-10k': b, '10k-15k': c, '15k': d}
|
||||
return {'5k以下': a, '5k-10k': b, '10k-15k': c, '15k以上': d}
|
||||
except:
|
||||
raise HTTPException(status_code=500,detail='查询异常!')
|
||||
|
||||
@@ -186,11 +186,11 @@ def classify_salary(db):
|
||||
def avg_salary(db):
|
||||
try:
|
||||
l=db.query(Student_Model.class_id,func.avg(Employment_info.salary).label('avg_salaries'))\
|
||||
.join(Employment_info,Employment_info.stu_id == Student_Model.stu_id)\
|
||||
.filter(Employment_info.salary>0,Employment_info.delete_status==0,Student_Model.delete_status==0)\
|
||||
.group_by(Student_Model.class_id)\
|
||||
.order_by(func.avg(Employment_info.salary).desc()).all()
|
||||
return l
|
||||
.join(Employment_info,Employment_info.stu_id == Student_Model.stu_id)\
|
||||
.filter(Employment_info.salary>0,Employment_info.delete_status==0,Student_Model.delete_status==0)\
|
||||
.group_by(Student_Model.class_id)\
|
||||
.order_by(func.avg(Employment_info.salary).desc()).all()
|
||||
return [{'class_id':i[0],'avg_salaries':i[1]} for i in l]
|
||||
except:
|
||||
raise HTTPException(status_code=500,detail='统计异常!')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user