提交
This commit is contained in:
1 parent
6e58022625
commit
3c629d2d58
7 files changed
+144
-21
No files matched your search
+33
-2
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.math.BigDecimal;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
@@ -51,8 +52,38 @@ public class XgConductScoreController extends BaseController {
|
||||
public R<XgConductScoreClassSummaryVo> classStudents(
|
||||
@NotNull(message = "学年不能为空") Integer academicYear,
|
||||
@NotNull(message = "学期不能为空") Integer semester,
|
||||
@NotNull(message = "月份不能为空") Integer month) {
|
||||
return R.ok(xgConductScoreService.getClassStudentsByTeacher(academicYear, semester, month));
|
||||
@NotNull(message = "月份不能为空") Integer month,
|
||||
@RequestParam(required = false) List<String> studentStatus,
|
||||
HttpServletRequest request) {
|
||||
// 兼容前端参数序列化 studentStatus[0]=1&studentStatus[1]=3 的情况
|
||||
if ((studentStatus == null || studentStatus.isEmpty())) {
|
||||
// 1) 尝试直接读取 studentStatus 数组参数
|
||||
String[] vals = request.getParameterValues("studentStatus");
|
||||
if (vals != null && vals.length > 0) {
|
||||
studentStatus = java.util.Arrays.asList(vals);
|
||||
} else {
|
||||
// 2) 尝试按下标的方式收集 studentStatus[0], studentStatus[1], ...
|
||||
java.util.List<String> collected = new java.util.ArrayList<>();
|
||||
java.util.Map<String, String[]> paramMap = request.getParameterMap();
|
||||
for (String key : paramMap.keySet()) {
|
||||
if (key != null && key.startsWith("studentStatus")) {
|
||||
String[] ps = paramMap.get(key);
|
||||
if (ps != null && ps.length > 0) {
|
||||
for (String p : ps) {
|
||||
if (p != null && !p.isEmpty()) {
|
||||
collected.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!collected.isEmpty()) {
|
||||
studentStatus = collected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok(xgConductScoreService.getClassStudentsByTeacher(academicYear, semester, month, studentStatus));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
@@ -35,6 +35,11 @@ public class XgConductScoreClassStudentVo {
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 学生状态
|
||||
*/
|
||||
private String studentStatus;
|
||||
|
||||
/**
|
||||
* 上月分数
|
||||
*/
|
||||
|
||||
+4
-2
@@ -62,10 +62,12 @@ public interface IXgConductScoreMapper extends BaseMapperPlus<XgConductScore, Xg
|
||||
* @param academicYear 学年
|
||||
* @param semester 学期
|
||||
* @param month 月份
|
||||
* @param studentStatus 学生状态列表
|
||||
* @return 学生列表
|
||||
*/
|
||||
List<Map<String, Object>> selectClassStudentsByTeacher(Long teacherId, Integer academicYear, Integer semester,
|
||||
Integer month);
|
||||
List<Map<String, Object>> selectClassStudentsByTeacher(@Param("teacherId") Long teacherId,
|
||||
@Param("academicYear") Integer academicYear, @Param("semester") Integer semester,
|
||||
@Param("month") Integer month, @Param("studentStatus") List<String> studentStatus);
|
||||
|
||||
/**
|
||||
* 查询学期平均分统计列表
|
||||
|
||||
+2
-1
@@ -107,9 +107,10 @@ public interface IXgConductScoreService {
|
||||
* @param academicYear 学年
|
||||
* @param semester 学期
|
||||
* @param month 月份
|
||||
* @param studentStatus 学生状态列表
|
||||
* @return 班级学生汇总信息
|
||||
*/
|
||||
XgConductScoreClassSummaryVo getClassStudentsByTeacher(Integer academicYear, Integer semester, Integer month);
|
||||
XgConductScoreClassSummaryVo getClassStudentsByTeacher(Integer academicYear, Integer semester, Integer month, List<String> studentStatus);
|
||||
|
||||
/**
|
||||
* 查询学期平均分统计
|
||||
|
||||
+3
-2
@@ -395,10 +395,10 @@ public class XgConductScoreServiceImpl implements IXgConductScoreService {
|
||||
*/
|
||||
@Override
|
||||
public XgConductScoreClassSummaryVo getClassStudentsByTeacher(Integer academicYear, Integer semester,
|
||||
Integer month) {
|
||||
Integer month, List<String> studentStatus) {
|
||||
Long teacherId = LoginHelper.getUserId();
|
||||
List<Map<String, Object>> rawData = baseMapper.selectClassStudentsByTeacher(teacherId, academicYear, semester,
|
||||
month);
|
||||
month, studentStatus);
|
||||
|
||||
// 手动组装数据结构
|
||||
XgConductScoreClassSummaryVo result = new XgConductScoreClassSummaryVo();
|
||||
@@ -430,6 +430,7 @@ public class XgConductScoreServiceImpl implements IXgConductScoreService {
|
||||
studentVo.setStudentNo((String) row.get("student_no"));
|
||||
studentVo.setStudentName((String) row.get("student_name"));
|
||||
studentVo.setGender((String) row.get("gender"));
|
||||
studentVo.setStudentStatus((String) row.get("student_status"));
|
||||
|
||||
// 设置上月分数
|
||||
if (row.get("last_score") != null) {
|
||||
|
||||
+9
@@ -320,6 +320,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
s.student_no,
|
||||
s.name AS student_name,
|
||||
s.gender,
|
||||
s.student_status,
|
||||
cs_last.score AS last_score,
|
||||
cs_last.month AS last_month,
|
||||
cs_current.id AS score_id,
|
||||
@@ -366,6 +367,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND CONCAT(LPAD(cs_inner.academic_year, 4, '0'), LPAD(cs_inner.semester, 1, '0'), LPAD(cs_inner.month, 2, '0')) = latest.max_date
|
||||
AND cs_inner.deleted = 0
|
||||
) cs_last ON s.id = cs_last.student_id
|
||||
<where>
|
||||
<if test="studentStatus != null and studentStatus.size() > 0">
|
||||
AND s.student_status IN
|
||||
<foreach collection="studentStatus" item="status" open="(" close=")" separator=",">
|
||||
#{status}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY tc.class_name, s.student_no
|
||||
</select>
|
||||
|
||||
|
||||
Reference in new issue
Block a user