fix 修复多租户下注册用户BUG

feature/model
Yjoioooo 2 years ago
parent a3ecc71558
commit 891f71b1c2

@ -31,7 +31,7 @@ public class SysRegisterController extends BaseController {
@SaIgnore @SaIgnore
@PostMapping("/register") @PostMapping("/register")
public R<Void> register(@Validated @RequestBody RegisterBody user) { public R<Void> register(@Validated @RequestBody RegisterBody user) {
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { if (!configService.selectRegisterEnabled(user.getTenantId())) {
return R.fail("当前系统没有开启注册功能!"); return R.fail("当前系统没有开启注册功能!");
} }
registerService.register(user); registerService.register(user);

@ -33,6 +33,13 @@ public interface ISysConfigService {
*/ */
String selectConfigByKey(String configKey); String selectConfigByKey(String configKey);
/**
*
* @param tenantId id
* @return truefalse
*/
boolean selectRegisterEnabled(String tenantId);
/** /**
* *
* *

@ -16,6 +16,7 @@ import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.mybatis.core.page.PageQuery; import com.ruoyi.common.mybatis.core.page.PageQuery;
import com.ruoyi.common.mybatis.core.page.TableDataInfo; import com.ruoyi.common.mybatis.core.page.TableDataInfo;
import com.ruoyi.common.redis.utils.CacheUtils; import com.ruoyi.common.redis.utils.CacheUtils;
import com.ruoyi.common.tenant.helper.TenantHelper;
import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.domain.bo.SysConfigBo; import com.ruoyi.system.domain.bo.SysConfigBo;
import com.ruoyi.system.domain.vo.SysConfigVo; import com.ruoyi.system.domain.vo.SysConfigVo;
@ -77,6 +78,22 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
/**
*
* @param tenantId id
* @return truefalse
*/
@Override
public boolean selectRegisterEnabled(String tenantId) {
SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>()
.eq(SysConfig::getConfigKey, "sys.account.registerUser")
.eq(TenantHelper.isEnable(),SysConfig::getTenantId, tenantId));
if (ObjectUtil.isNull(retConfig)) {
return false;
}
return Convert.toBool(retConfig.getConfigValue());
}
/** /**
* *
* *

Loading…
Cancel
Save