Explorar el Código

新增删除用户限制,存在项目不允许删除

anderx hace 2 años
padre
commit
a572423d85

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -538,6 +538,10 @@ public class SysUserServiceImpl implements ISysUserService
                 if (StringUtils.isEmpty(user.getFullJob())){
                     throw  new ServiceException("全职/兼职数据异常");
                 }
+                SysUser sysUser1 = userMapper.selectUserByUserName(user.getUserName());
+                if (sysUser1 != null){
+                    throw  new ServiceException("用户名(账号)已存在");
+                }
                 // 验证是否存在这个用户
                 SysUser u = userMapper.checkJobNumber(user.getJobNumber(),company);
                 if (StringUtils.isNull(u)){