|  | @@ -2,17 +2,24 @@ package com.ruoyi.sim.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.entity.SysRole;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.ruoyi.sim.domain.AddOnDept;
 | 
	
		
			
				|  |  | +import com.ruoyi.sim.domain.Major;
 | 
	
		
			
				|  |  | +import com.ruoyi.sim.domain.Student;
 | 
	
		
			
				|  |  | +import com.ruoyi.sim.service.IAddOnDeptService;
 | 
	
		
			
				|  |  | +import com.ruoyi.sim.service.IMajorService;
 | 
	
		
			
				|  |  |  import com.ruoyi.system.mapper.*;
 | 
	
		
			
				|  |  |  import com.ruoyi.system.service.ISysConfigService;
 | 
	
		
			
				|  |  |  import com.ruoyi.system.service.ISysDeptService;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | +import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.validation.Validator;
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.Objects;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class StudentService {
 | 
	
	
		
			
				|  | @@ -41,19 +48,33 @@ public class StudentService {
 | 
	
		
			
				|  |  |      private ISysDeptService deptService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | +    private IAddOnDeptService addOnDeptService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IMajorService majorService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  |      protected Validator validator;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // @DataScope(deptAlias = "d", userAlias = "u")
 | 
	
		
			
				|  |  | -    public List<SysUser> selectStudentList() {
 | 
	
		
			
				|  |  | +    public List<Student> selectStudentList() {
 | 
	
		
			
				|  |  |          SysUser su = new SysUser();
 | 
	
		
			
				|  |  | -        List<SysUser> list  = userMapper.selectUserList(su);
 | 
	
		
			
				|  |  | -        List<SysUser> list2 = new ArrayList<SysUser>();
 | 
	
		
			
				|  |  | -        // todo:
 | 
	
		
			
				|  |  | +        List<SysUser> list = userMapper.selectUserList(su);
 | 
	
		
			
				|  |  | +        List<Student> list2 = new ArrayList<>();
 | 
	
		
			
				|  |  | +        // todo:分页
 | 
	
		
			
				|  |  |          for (SysUser sysUser : list) {
 | 
	
		
			
				|  |  |              List<SysRole> listR = roleMapper.selectRolesByUserName(sysUser.getUserName());
 | 
	
		
			
				|  |  |              for (SysRole sysRole : listR) {
 | 
	
		
			
				|  |  | -                if (sysRole.getRoleId() == Consts.ROLE_ID_STUDENT) {
 | 
	
		
			
				|  |  | -                    list2.add(sysUser);
 | 
	
		
			
				|  |  | +                if (Objects.equals(sysRole.getRoleId(), Consts.ROLE_ID_STUDENT)) {
 | 
	
		
			
				|  |  | +                    long deptId = sysUser.getDeptId();
 | 
	
		
			
				|  |  | +                    Student target = new Student();
 | 
	
		
			
				|  |  | +                    BeanUtils.copyProperties(sysUser, target);
 | 
	
		
			
				|  |  | +                    list2.add(target);
 | 
	
		
			
				|  |  | +                    AddOnDept a = addOnDeptService.selectAddOnDeptByDeptId(deptId);
 | 
	
		
			
				|  |  | +                    Major m = majorService.selectMajorByMajorId(a.getMajorId());
 | 
	
		
			
				|  |  | +                    if (Objects.nonNull(m)) {
 | 
	
		
			
				|  |  | +                        target.setMajor(m);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      break;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 |