| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.exception.CustomException;
|
| | | import com.ruoyi.common.exception.ServiceException;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
|
| | |
| | | {
|
| | | if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
|
| | | {
|
| | | throw new CustomException("不允许操作超级管理员用户");
|
| | | throw new ServiceException("不允许操作超级管理员用户");
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | // 新增用户与角色管理
|
| | | insertUserRole(user);
|
| | | return rows;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 注册用户信息
|
| | | * |
| | | * @param user 用户信息
|
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public boolean registerUser(SysUser user)
|
| | | {
|
| | | return userMapper.insertUser(user) > 0;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param roleIds 角色组
|
| | | */
|
| | | @Override
|
| | | @Transactional
|
| | | public void insertUserAuth(Long userId, Long[] roleIds)
|
| | | {
|
| | | userRoleMapper.deleteUserRoleByUserId(userId);
|
| | |
| | | {
|
| | | if (StringUtils.isNull(userList) || userList.size() == 0)
|
| | | {
|
| | | throw new CustomException("导入用户数据不能为空!");
|
| | | throw new ServiceException("导入用户数据不能为空!");
|
| | | }
|
| | | int successNum = 0;
|
| | | int failureNum = 0;
|
| | |
| | | if (failureNum > 0)
|
| | | {
|
| | | failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
| | | throw new CustomException(failureMsg.toString());
|
| | | throw new ServiceException(failureMsg.toString());
|
| | | }
|
| | | else
|
| | | {
|