| | |
| | | @Override |
| | | public int insertStudent(ExStudent student) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | student.setCompanyId(currentUser.getCompanyId()); |
| | | if (student.getCompanyId()==null){ |
| | | student.setCompanyId(currentUser.getCompanyId()); |
| | | } |
| | | checkUserAllowed(student); |
| | | if(!checkPhoneUnique(student)){ |
| | | throw new ApiException("手机号已存在"); |
| | |
| | | public void checkUserAllowed(ExStudent student) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | if(student.getId()!=null){ |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) || currentUser.getUserType().equals(UserTypeEnum.COMPANY_ADMIN.getCode())){ |
| | | return; |
| | | } |
| | | if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode()) ){ |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())){ |
| | | throw new ApiException("系统管理员没有权限操作"); |
| | | if(currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) || currentUser.getUserType().equals(UserTypeEnum.COMPANY_ADMIN.getCode())){ |
| | | return; |
| | | } |
| | | if(currentUser.getUserType().equals(UserTypeEnum.STUDENT.getCode())){ |
| | | throw new ApiException("没有权限操作"); |