kindergarten_java/.claude/plans/imperative-honking-kazoo.md
En 1038a70d92 refactor(租户管理): 调整配额模态框移除套餐选择器
- 移除调整配额模态框中的套餐选择功能
- quotaForm 数据定义移除 collectionIds 字段
- 简化 handleQuota 函数,仅保留配额相关逻辑
- 使前端与后端 UpdateTenantQuotaDto 接口保持一致

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 16:26:53 +08:00

101 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 学校端家长管理"选择孩子"列表字段完善计划
## 问题背景
学校端家长管理页面中的"选择孩子"弹窗列表(用于将学生关联到家长)缺少两个关键字段的显示:
1. **性别** (gender) - 学生性别
2. **所属班级** (className) - 学生所在班级名称
## 问题分析
通过代码审查发现:
### 1. 前端代码 (`ParentListView.vue`)
- 第 597-601 行定义了表格列,期望显示 `gender``className`
```typescript
const studentTableColumns = [
{ title: '姓名', dataIndex: 'name', key: 'name', width: 120 },
{ title: '性别', dataIndex: 'gender', key: 'gender', width: 80 },
{ title: '班级', dataIndex: 'className', key: 'className', width: 120 },
];
```
### 2. 后端代码 (`SchoolStudentController.java`)
- 第 89-119 行的 `getStudentPage` 方法返回学生列表
- 目前只设置了 `classId`,未设置 `className`
### 3. DTO (`StudentResponse.java`)
-`gender` 字段(第 29 行)✅
-`classId` 字段(第 56 行)✅
- **缺少 `className` 字段** ❌
### 4. 实体类 (`Student.java`)
-`gender` 字段(第 26 行)✅
## 根本原因
1. `StudentResponse` DTO 缺少 `className` 字段
2. Controller 中只查询和设置了 `classId`,没有查询班级名称并设置 `className`
## 修改方案
### 1. 添加 `className` 字段到 `StudentResponse`
**文件**: `reading-platform-java/src/main/java/com/reading/platform/dto/response/StudentResponse.java`
`classId` 字段后添加 `className` 字段:
```java
@Schema(description = "所在班级 ID")
private Long classId;
@Schema(description = "所在班级名称")
private String className;
```
### 2. 在 Controller 中设置 `className`
**文件**: `reading-platform-java/src/main/java/com/reading/platform/controller/school/SchoolStudentController.java`
修改 `getStudentPage` 方法(第 100-118 行):
```java
for (StudentResponse vo : voList) {
// 设置班级
var clazz = classService.getPrimaryClassByStudentId(vo.getId());
vo.setClassId(clazz != null ? clazz.getId() : null);
vo.setClassName(clazz != null ? clazz.getName() : null); // 新增
// ... 其余代码不变
}
```
同样修改 `getStudent` 方法(第 66-86 行),添加 `className` 的设置。
### 3. 验证 `gender` 字段
`gender` 字段应该已通过 MapStruct 自动映射。如果前端仍不显示,需要检查:
- 数据库中 `gender` 字段是否有值
- Mapper 是否正确映射了该字段
## 关键文件列表
| 文件路径 | 修改类型 | 说明 |
|---------|---------|------|
| `reading-platform-java/src/main/java/com/reading/platform/dto/response/StudentResponse.java` | 修改 | 添加 `className` 字段 |
| `reading-platform-java/src/main/java/com/reading/platform/controller/school/SchoolStudentController.java` | 修改 | 设置 `className` 字段值 |
## 验证步骤
1. 启动后端服务
2. 进入学校端家长管理页面
3. 点击任意家长的"孩子"按钮打开管理弹窗
4. 点击"添加孩子"打开选择学生弹窗
5. 验证表格中是否正确显示:
- 性别列(男/女)
- 班级列(班级名称)
## 风险评估
- **低风险**:只是添加一个返回字段,不影响现有功能
- **向后兼容**:前端已准备好接收这些字段,不会破坏现有功能