| | |
| | | import com.gkhy.exam.system.domain.vo.EmployeeRecordVO; |
| | | import com.gkhy.exam.system.domain.vo.SpSysUser; |
| | | import com.gkhy.exam.system.mapper.EmployeeRecordMapper; |
| | | import com.gkhy.exam.system.mapper.ExStudentMapper; |
| | | import com.gkhy.exam.system.mapper.SysUserMapper; |
| | | import com.gkhy.exam.system.mapper.SysUserRoleMapper; |
| | | import com.gkhy.exam.system.service.ExStudentService; |
| | |
| | | |
| | | @Autowired |
| | | private EmployeeRecordMapper employeeRecordMapper; |
| | | |
| | | @Autowired |
| | | private ExStudentMapper exStudentMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | public SysUser selectUserById(Long userId) { |
| | | |
| | | |
| | | |
| | | |
| | | return baseMapper.getUserById(userId); |
| | | } |
| | | |
| | |
| | | |
| | | batchSaveRole(user.getRoles(), user.getId(), false); |
| | | |
| | | if (user.getCompanyId() != null) { |
| | | ExStudent exStudent = new ExStudent(); |
| | | exStudent.setCompanyId(user.getCompanyId()); |
| | | exStudent.setName(user.getName()); |
| | |
| | | exStudent.setPhone(user.getPhone()); |
| | | exStudent.setUserId(user.getId()); |
| | | exStudentService.insertStudent(exStudent); |
| | | |
| | | Integer internal = user.getInternal(); |
| | | if (internal == 0){ |
| | | EmployeeRecord employeeRecord = new EmployeeRecord(); |
| | |
| | | employeeRecord.setCreateTime(LocalDateTime.now()); |
| | | saveEmployeeRecord(employeeRecord); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (row < 1) { |
| | | throw new ApiException("新增用户失败"); |
| | |
| | | }else { |
| | | user.setPassword(null); |
| | | } |
| | | if (sysUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ |
| | | if (user.getCompanyId() == null){ |
| | | throw new ApiException("请选择所属公司"); |
| | | } |
| | | } |
| | | if (user.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !sysUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ |
| | | user.setCompanyId(null); |
| | | delEmployeeRecord(user.getId()); |
| | | LambdaUpdateWrapper<ExStudent> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(ExStudent::getUserId, user.getId()).set(ExStudent::getDelFlag, 1) |
| | | .set(ExStudent::getUpdateBy, SecurityUtils.getUsername()).set(ExStudent::getUpdateTime, LocalDateTime.now()); |
| | | exStudentMapper.update(new ExStudent(),updateWrapper); |
| | | } |
| | | |
| | | int row = baseMapper.updateById(user); |
| | | batchSaveRole(user.getRoles(), user.getId(), true); |
| | | |
| | | if (user.getCompanyId() != null){ |
| | | if (sysUser.getInternal() == 0 && sysUser.getInternal() == 1){ |
| | | delEmployeeRecord(user.getId()); |
| | | }else if (sysUser.getInternal() == 1 && user.getInternal() == 0){ |
| | |
| | | employeeRecord.setCreateTime(LocalDateTime.now()); |
| | | saveEmployeeRecord(employeeRecord); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (row < 1) { |
| | | throw new ApiException("更新用户信息失败"); |