fix: 会员管理编辑页绑定学生显示学校、年级、班级

修改 selectByMemberId 接口返回 StudentVo 而非 PgStudent,
包含学校名称、年级名称、班级名称等关联数据
This commit is contained in:
神码-方晓辉 2026-02-02 20:40:09 +08:00
parent 6eb0643ae7
commit 3d70bd0356
4 changed files with 11 additions and 9 deletions

View File

@ -10,7 +10,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController; import org.dromara.common.web.core.BaseController;
import org.dromara.pangu.member.domain.PgMember; import org.dromara.pangu.member.domain.PgMember;
import org.dromara.pangu.member.service.IPgMemberService; import org.dromara.pangu.member.service.IPgMemberService;
import org.dromara.pangu.student.domain.PgStudent; import org.dromara.pangu.student.domain.vo.StudentVo;
import org.dromara.pangu.student.service.IPgStudentService; import org.dromara.pangu.student.service.IPgStudentService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -113,10 +113,10 @@ public class PgMemberController extends BaseController {
} }
/** /**
* 获取会员已绑定的学生列表 * 获取会员已绑定的学生列表包含学校年级班级名称
*/ */
@GetMapping("/{memberId}/students") @GetMapping("/{memberId}/students")
public R<List<PgStudent>> getMemberStudents(@PathVariable Long memberId) { public R<List<StudentVo>> getMemberStudents(@PathVariable Long memberId) {
return R.ok(studentService.selectByMemberId(memberId)); return R.ok(studentService.selectByMemberId(memberId));
} }

View File

@ -99,10 +99,10 @@ public class PgStudentController extends BaseController {
} }
/** /**
* 查询会员已绑定的学生列表 * 查询会员已绑定的学生列表包含学校年级班级名称
*/ */
@GetMapping("/byMember/{memberId}") @GetMapping("/byMember/{memberId}")
public R<java.util.List<PgStudent>> listByMemberId(@PathVariable Long memberId) { public R<List<StudentVo>> listByMemberId(@PathVariable Long memberId) {
return R.ok(studentService.selectByMemberId(memberId)); return R.ok(studentService.selectByMemberId(memberId));
} }

View File

@ -33,9 +33,9 @@ public interface IPgStudentService {
TableDataInfo<PgStudent> selectAvailableStudents(String studentName, String studentNo, Long memberId, Long schoolId, PageQuery pageQuery); TableDataInfo<PgStudent> selectAvailableStudents(String studentName, String studentNo, Long memberId, Long schoolId, PageQuery pageQuery);
/** /**
* 查询会员已绑定的学生列表 * 查询会员已绑定的学生列表包含学校年级班级名称
*/ */
List<PgStudent> selectByMemberId(Long memberId); List<StudentVo> selectByMemberId(Long memberId);
/** /**
* 批量绑定学生到会员 * 批量绑定学生到会员

View File

@ -243,15 +243,17 @@ public class PgStudentServiceImpl implements IPgStudentService {
} }
@Override @Override
public List<PgStudent> selectByMemberId(Long memberId) { public List<StudentVo> selectByMemberId(Long memberId) {
if (memberId == null) { if (memberId == null) {
return List.of(); return List.of();
} }
return baseMapper.selectList( List<PgStudent> students = baseMapper.selectList(
new LambdaQueryWrapper<PgStudent>() new LambdaQueryWrapper<PgStudent>()
.eq(PgStudent::getMemberId, memberId) .eq(PgStudent::getMemberId, memberId)
.orderByDesc(PgStudent::getCreateTime) .orderByDesc(PgStudent::getCreateTime)
); );
// 转换为 VO包含学校年级班级名称
return convertToVoList(students);
} }
@Override @Override