点名、成绩册统一读取“行政班在籍学生 ∪ 已选课学生”,不再错误显示 0 人。

教师选课名单改为展示全部本人教学班及完整学生名单,支持 Excel 导出。
调停课改用教师专用教学班接口,并在服务端限制只能操作本人教学班。
This commit is contained in:
2026-07-27 08:05:42 +08:00 Unverified
parent bc6ffa2ada
commit 22321abe23
9 changed files with 491 additions and 69 deletions
@@ -6,6 +6,7 @@ using Jiaowu.Api.Infrastructure.Auth;
using Jiaowu.Api.Infrastructure.Excel;
using Jiaowu.Api.Infrastructure.Grades;
using Jiaowu.Api.Infrastructure.Persistence;
using Jiaowu.Api.Infrastructure.Teaching;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@@ -134,15 +135,13 @@ public sealed class GradesController(
cancellationToken))
return ConflictProblem("该教学班已经建立成绩单。");
var studentIds = await db.CourseEnrollments.AsNoTracking()
.Where(x =>
x.Status == CourseEnrollmentStatus.Enrolled &&
x.CourseSelectionOffering!.TeachingTaskId == task.Id)
.Select(x => x.StudentId)
.Distinct()
var studentIds = await TeachingTaskRosterQuery
.ForTask(db, task.Id)
.AsNoTracking()
.Select(x => x.Id)
.ToListAsync(cancellationToken);
if (studentIds.Count == 0)
return ConflictProblem("教学班当前没有有效选课学生,无法建立成绩单。");
return ConflictProblem("教学班当前没有有效学生,无法建立成绩单。");
var sheet = new GradeSheet
{