fix 修复 多租户相同账号登录失败问题

feature/model
疯狂的狮子li 2 years ago
parent 4b814886b2
commit 37794b5738

@ -216,6 +216,9 @@ public class SysLoginService {
log.info("登录用户:{} 已被停用.", username);
throw new UserException("user.blocked", username);
}
if (TenantHelper.isEnable()) {
return userMapper.selectTenantUserByUserName(username, tenantId);
}
return userMapper.selectUserByUserName(username);
}
@ -231,6 +234,9 @@ public class SysLoginService {
log.info("登录用户:{} 已被停用.", phonenumber);
throw new UserException("user.blocked", phonenumber);
}
if (TenantHelper.isEnable()) {
return userMapper.selectTenantUserByPhonenumber(phonenumber, tenantId);
}
return userMapper.selectUserByPhonenumber(phonenumber);
}

@ -1,12 +1,13 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.mybatis.annotation.DataColumn;
import com.ruoyi.common.mybatis.annotation.DataPermission;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.common.mybatis.core.mapper.BaseMapperPlus;
import com.ruoyi.system.domain.SysUser;
import com.ruoyi.system.domain.vo.SysUserVo;
import org.apache.ibatis.annotations.Param;
@ -77,6 +78,26 @@ public interface SysUserMapper extends BaseMapperPlus<SysUserMapper, SysUser, Sy
*/
SysUserVo selectUserByPhonenumber(String phonenumber);
/**
* ()
*
* @param userName
* @param tenantId id
* @return
*/
@InterceptorIgnore(tenantLine = "true")
SysUserVo selectTenantUserByUserName(String userName, String tenantId);
/**
* ()
*
* @param phonenumber
* @param tenantId id
* @return
*/
@InterceptorIgnore(tenantLine = "true")
SysUserVo selectTenantUserByPhonenumber(String phonenumber, String tenantId);
/**
* ID
*

@ -102,6 +102,16 @@
where u.del_flag = '0' and u.phonenumber = #{phonenumber}
</select>
<select id="selectTenantUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.del_flag = '0' and u.user_name = #{userName} and u.tenant_id = #{tenantId}
</select>
<select id="selectTenantUserByPhonenumber" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.del_flag = '0' and u.phonenumber = #{phonenumber} and u.tenant_id = #{tenantId}
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.del_flag = '0' and u.user_id = #{userId}

Loading…
Cancel
Save