|  | @@ -84,18 +84,27 @@ public class StudentService {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      public Student selectStudentByUserId(Long userId) {
 |  |      public Student selectStudentByUserId(Long userId) {
 | 
											
												
													
														|  |          SysUser sysUser = userMapper.selectUserById(userId);
 |  |          SysUser sysUser = userMapper.selectUserById(userId);
 | 
											
												
													
														|  | -        // 屏蔽密码
 |  | 
 | 
											
												
													
														|  | -        sysUser.setPassword("");
 |  | 
 | 
											
												
													
														|  |          Student student = new Student();
 |  |          Student student = new Student();
 | 
											
												
													
														|  | -        BeanUtils.copyProperties(sysUser, student);
 |  | 
 | 
											
												
													
														|  | -        student.setMajor(getMajorByDeptId(sysUser.getDeptId()));
 |  | 
 | 
											
												
													
														|  | -        // logger.info(Objects.requireNonNull(student.toString()));
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // todo:用户角色判断。
 | 
											
												
													
														|  | 
 |  | +        // 屏蔽密码
 | 
											
												
													
														|  | 
 |  | +        if (Objects.nonNull(sysUser)) {
 | 
											
												
													
														|  | 
 |  | +            sysUser.setPassword("");
 | 
											
												
													
														|  | 
 |  | +            BeanUtils.copyProperties(sysUser, student);
 | 
											
												
													
														|  | 
 |  | +            Major m = getMajorByDeptId(sysUser.getDeptId());
 | 
											
												
													
														|  | 
 |  | +            if (Objects.nonNull(m)) {
 | 
											
												
													
														|  | 
 |  | +                student.setMajor(m);
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            // logger.info(Objects.requireNonNull(student.toString()));
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |          return student;
 |  |          return student;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    public Major getMajorByDeptId(long deptId) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public Major getMajorByDeptId(Long deptId) {
 | 
											
												
													
														|  |          AddOnDept a = addOnDeptService.selectAddOnDeptByDeptId(deptId);
 |  |          AddOnDept a = addOnDeptService.selectAddOnDeptByDeptId(deptId);
 | 
											
												
													
														|  | -        Major m = majorService.selectMajorByMajorId(a.getMajorId());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        Major m = null;
 | 
											
												
													
														|  | 
 |  | +        if (Objects.nonNull(a)) {
 | 
											
												
													
														|  | 
 |  | +            m = majorService.selectMajorByMajorId(a.getMajorId());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |          return m;
 |  |          return m;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  }
 |  |  }
 |