新增:添加租户接口(去掉权限)

This commit is contained in:
2025-01-20 20:45:49 +08:00
parent 3b03496c54
commit 294c2febda

View File

@@ -2,15 +2,14 @@ package com.gxwebsoft.common.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.gxwebsoft.common.core.config.ConfigProperties;
import com.gxwebsoft.common.core.exception.BusinessException; import com.gxwebsoft.common.core.exception.BusinessException;
import com.gxwebsoft.common.core.utils.CommonUtil;
import com.gxwebsoft.common.core.utils.JSONUtil; import com.gxwebsoft.common.core.utils.JSONUtil;
import com.gxwebsoft.common.core.utils.RedisUtil; import com.gxwebsoft.common.core.utils.RedisUtil;
import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.common.system.entity.*; import com.gxwebsoft.common.system.entity.*;
import com.gxwebsoft.common.system.service.CompanyService; import com.gxwebsoft.common.system.service.*;
import com.gxwebsoft.common.system.service.MenuService;
import com.gxwebsoft.common.system.service.RoleMenuService;
import com.gxwebsoft.common.system.service.TenantService;
import com.gxwebsoft.common.system.param.TenantParam; import com.gxwebsoft.common.system.param.TenantParam;
import com.gxwebsoft.common.core.web.ApiResult; import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.core.web.PageResult;
@@ -194,6 +193,17 @@ public class TenantController extends BaseController {
return fail("租户编号已存在"); return fail("租户编号已存在");
} }
if (tenantService.save(tenant)) { if (tenantService.save(tenant)) {
// 租户初始化
final Company company = new Company();
company.setDomain(tenant.getTenantId().toString().concat(".websoft.top"));
company.setEmail("");
company.setPhone(tenant.getPhone());
company.setPassword("");
company.setTid(tenant.getTenantId());
company.setCompanyName(tenant.getTenantName());
company.setShortName(tenant.getTenantName());
company.setTenantId(tenant.getTenantId());
tenantService.initialization(company);
return success("添加成功",tenant); return success("添加成功",tenant);
} }
return fail("添加失败"); return fail("添加失败");