优化教师信息查询

master
Alan 4 months ago
parent 309b6cb6c9
commit fa9571e2c5
  1. 2
      src/main/java/com/teaching/backend/model/vo/courses/TeacherInfVO.java
  2. 10
      src/main/java/com/teaching/backend/service/impl/umsAdmin/UmsUserServiceImpl.java

@ -10,7 +10,7 @@ import lombok.Data;
public class TeacherInfVO {
/**
* 教师username
* 教师userId
*/
@ApiModelProperty("教师userId")
private Long userId;

@ -381,15 +381,13 @@ public class UmsUserServiceImpl extends ServiceImpl<UmsUserMapper, UmsUser> impl
}
@Override
public List<TeacherInfVO> getTeacherInfList() {
List<UmsUser> umsUserTeachers = query().eq("role_id", TEACHER_ROLE).list();
List<UmsTeacher> umsTeachers = umsTeacherMapper.selectList(new LambdaQueryWrapper<>(UmsTeacher.class));
TeacherInfVO teacherInfVO = null;
List<TeacherInfVO> teacherInfList = new ArrayList<>();
for (UmsUser umsUserTeacher : umsUserTeachers) {
for (UmsTeacher umsTeacher : umsTeachers) {
teacherInfVO = new TeacherInfVO();
String teacherName = umsTeacherMapper.selectOne(new LambdaQueryWrapper<>(UmsTeacher.class)
.eq(UmsTeacher::getUserId, umsUserTeacher.getId())).getName();
teacherInfVO.setName(teacherName);
teacherInfVO.setUserId(umsUserTeacher.getId());
teacherInfVO.setName(umsTeacher.getName());
teacherInfVO.setUserId(umsTeacher.getUserId());
teacherInfList.add(teacherInfVO);
}
return teacherInfList;

Loading…
Cancel
Save