v0.6测试
This commit is contained in:
@@ -109,14 +109,16 @@ class StudentModel:
|
||||
async def get_ranking(limit: int = 50) -> List[Dict[str, Any]]:
|
||||
"""获取学生排行(单班级)"""
|
||||
sql = """
|
||||
SELECT student_id, student_no, name, total_points,
|
||||
RANK() OVER (ORDER BY total_points DESC) as rank
|
||||
FROM students
|
||||
SELECT student_id, student_no, name, total_points
|
||||
FROM students
|
||||
WHERE status = 1
|
||||
ORDER BY total_points DESC
|
||||
LIMIT %s
|
||||
"""
|
||||
return await execute_query(sql, (limit,))
|
||||
results = await execute_query(sql, (limit,))
|
||||
for i, row in enumerate(results):
|
||||
row['rank'] = i + 1
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
async def batch_create(students_data: List[Dict], initial_points: int = 60) -> List[Dict]:
|
||||
|
||||
Reference in New Issue
Block a user