| | |
| | | @Override |
| | | public int insertExamRecord(ExExamRecord examRecord) { |
| | | checkUserAllowed(examRecord); |
| | | examRecord.setCompanyId(SecurityUtils.getLoginUser().getUser().getCompanyId()); |
| | | examRecord.setCreateBy(SecurityUtils.getUsername()); |
| | | int row=baseMapper.insert(examRecord); |
| | | if(row<1){ |
| | | throw new ApiException("新增登记记录失败"); |
| | |
| | | @Override |
| | | public int updateExamRecord(ExExamRecord examRecord) { |
| | | checkUserAllowed(examRecord); |
| | | examRecord.setUpdateBy(SecurityUtils.getUsername()); |
| | | int row=baseMapper.updateById(examRecord); |
| | | if(row<1){ |
| | | throw new ApiException("更新登记记录失败"); |
| | |
| | | public void checkUserAllowed(ExExamRecord examRecord) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ |
| | | return; |
| | | throw new ApiException("管理员没有权限操作"); |
| | | } |
| | | if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode())){ |
| | | throw new ApiException("没有权限操作"); |
| | | } |
| | | if(!currentUser.getCompanyId().equals(examRecord.getCompanyId())){ |
| | | if(examRecord.getCompanyId()!=null&&!currentUser.getCompanyId().equals(examRecord.getCompanyId())){ |
| | | throw new ApiException("没有权限操作其他企业登记记录"); |
| | | } |
| | | } |