v4.4 数据报表/操作日志/系统设置与月度分排行
1. 月度分排行:管理端首页支持总分/月度分切换与月份选择,新增排行榜导出CSV 2. 数据报表:新增考勤/作业统计页(日期范围、汇总与每人明细、CSV导出) 3. 操作日志:新增查看页(操作类型/操作人/日期筛选,分页) 4. 系统设置:密码策略可配置(长度/字符种类),全站改密与重置统一校验、前端提示同步;策略通过公开配置下发 5. 学期归档对比:查看归档时展示与上一学期的分数变化与名次升降 6. 历史记录导出支持按学生分表(每人一段,便于发家长) 7. 移动端适配:导航横向滚动、表格触控滚动、字号与弹窗优化 8. 版本升级至4.4(无数据库结构变更)
This commit is contained in:
1 parent
9a19add6c1
commit
768ea281e0
54 files changed
+1782
-90
No files matched your search
@@ -169,6 +169,32 @@ class StudentModel:
|
||||
for i, row in enumerate(results):
|
||||
row['rank'] = i + 1
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
async def get_monthly_ranking(month: str, limit: int = 100) -> List[Dict[str, Any]]:
|
||||
"""获取月度操行分排行(月度分 = 当月加分 - 当月减分,与基础分无关)"""
|
||||
sql = """
|
||||
SELECT s.student_id, s.student_no, s.name,
|
||||
COALESCE(SUM(CASE WHEN cr.points_change > 0 THEN cr.points_change ELSE 0 END), 0) AS bonus,
|
||||
COALESCE(SUM(CASE WHEN cr.points_change < 0 THEN cr.points_change ELSE 0 END), 0) AS deduction,
|
||||
COALESCE(SUM(cr.points_change), 0) AS month_score
|
||||
FROM students s
|
||||
LEFT JOIN conduct_records cr
|
||||
ON cr.student_id = s.student_id
|
||||
AND cr.is_revoked = 0
|
||||
AND DATE_FORMAT(cr.created_at, '%%Y-%%m') = %s
|
||||
WHERE s.status = 1
|
||||
GROUP BY s.student_id, s.student_no, s.name
|
||||
ORDER BY month_score DESC, s.student_id ASC
|
||||
LIMIT %s
|
||||
"""
|
||||
results = await execute_query(sql, (month, limit))
|
||||
for i, row in enumerate(results):
|
||||
row['rank'] = i + 1
|
||||
row['bonus'] = int(row.get('bonus') or 0)
|
||||
row['deduction'] = int(row.get('deduction') or 0)
|
||||
row['month_score'] = int(row.get('month_score') or 0)
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
async def get_total_count() -> int:
|
||||
|
||||
Reference in new issue
Block a user