| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.constant.GlobalConstants; |
| | | import com.ruoyi.common.core.constant.TenantConstants; |
| | | import com.ruoyi.common.core.domain.dto.RoleDTO; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.core.domain.model.XcxLoginUser; |
| | |
| | | public void logout() { |
| | | try { |
| | | LoginUser loginUser = LoginHelper.getLoginUser(); |
| | | if (TenantHelper.isEnable() && LoginHelper.isSuperAdmin()) { |
| | | // 超级管理员 登出清除动态租户 |
| | | TenantHelper.clearDynamic(); |
| | | } |
| | | StpUtil.logout(); |
| | | recordLogininfor(loginUser.getTenantId(), loginUser.getUsername(), Constants.LOGOUT, MessageUtils.message("user.logout.success")); |
| | | } catch (NotLoginException ignored) { |
| | |
| | | log.info("登录用户:{} 已被停用.", username); |
| | | throw new UserException("user.blocked", username); |
| | | } |
| | | if (TenantHelper.isEnable()) { |
| | | return userMapper.selectTenantUserByUserName(username, tenantId); |
| | | } |
| | | return userMapper.selectUserByUserName(username); |
| | | } |
| | | |
| | |
| | | } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { |
| | | log.info("登录用户:{} 已被停用.", phonenumber); |
| | | throw new UserException("user.blocked", phonenumber); |
| | | } |
| | | if (TenantHelper.isEnable()) { |
| | | return userMapper.selectTenantUserByPhonenumber(phonenumber, tenantId); |
| | | } |
| | | return userMapper.selectUserByPhonenumber(phonenumber); |
| | | } |
| | |
| | | if (!TenantHelper.isEnable()) { |
| | | return; |
| | | } |
| | | if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) { |
| | | return; |
| | | } |
| | | SysTenantVo tenant = tenantService.queryByTenantId(tenantId); |
| | | if (ObjectUtil.isNull(tenant)) { |
| | | log.info("登录租户:{} 不存在.", tenantId); |