|
|
@ -10,8 +10,8 @@ import com.cloud.kicc.common.core.api.R; |
|
|
|
import com.cloud.kicc.common.core.constant.AppConstants; |
|
|
|
import com.cloud.kicc.common.core.constant.AppConstants; |
|
|
|
import com.cloud.kicc.common.log.annotation.SysLog; |
|
|
|
import com.cloud.kicc.common.log.annotation.SysLog; |
|
|
|
import com.cloud.kicc.common.security.util.SecurityUtils; |
|
|
|
import com.cloud.kicc.common.security.util.SecurityUtils; |
|
|
|
import com.cloud.kicc.system.api.entity.Tenant; |
|
|
|
import com.cloud.kicc.system.api.entity.*; |
|
|
|
import com.cloud.kicc.system.api.entity.User; |
|
|
|
import com.cloud.kicc.system.service.RoleTenantService; |
|
|
|
import com.cloud.kicc.system.service.TenantService; |
|
|
|
import com.cloud.kicc.system.service.TenantService; |
|
|
|
import com.cloud.kicc.system.service.UserService; |
|
|
|
import com.cloud.kicc.system.service.UserService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@ -36,6 +36,7 @@ public class TenantController { |
|
|
|
|
|
|
|
|
|
|
|
private final TenantService tenantService; |
|
|
|
private final TenantService tenantService; |
|
|
|
private final UserService userService; |
|
|
|
private final UserService userService; |
|
|
|
|
|
|
|
private final RoleTenantService roleTenantService; |
|
|
|
|
|
|
|
|
|
|
|
private LambdaQueryWrapper<Tenant> getQueryWrapper(Tenant tenant) { |
|
|
|
private LambdaQueryWrapper<Tenant> getQueryWrapper(Tenant tenant) { |
|
|
|
return new LambdaQueryWrapper<Tenant>() |
|
|
|
return new LambdaQueryWrapper<Tenant>() |
|
|
@ -84,6 +85,13 @@ public class TenantController { |
|
|
|
@DeleteMapping("/remove/{ids:[\\w,]+}") |
|
|
|
@DeleteMapping("/remove/{ids:[\\w,]+}") |
|
|
|
@PreAuthorize("@pms.hasPermission('tenant_del')") |
|
|
|
@PreAuthorize("@pms.hasPermission('tenant_del')") |
|
|
|
public R remove(@PathVariable String[] ids) { |
|
|
|
public R remove(@PathVariable String[] ids) { |
|
|
|
|
|
|
|
// todo: 防止核心多租户删除,暂时处理手段
|
|
|
|
|
|
|
|
if(ArrayUtil.contains(ids, "1523396238015426562")){ |
|
|
|
|
|
|
|
return R.error("不允许删除核心多租户数据!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (roleTenantService.count(new LambdaQueryWrapper<RoleTenant>().in(RoleTenant::getMultiTenantId, ids)) > 0) { |
|
|
|
|
|
|
|
return R.error("多租户已分配,不允许删除"); |
|
|
|
|
|
|
|
} |
|
|
|
tenantService.removeByIds(Arrays.asList(ids)); |
|
|
|
tenantService.removeByIds(Arrays.asList(ids)); |
|
|
|
return R.ok(); |
|
|
|
return R.ok(); |
|
|
|
} |
|
|
|
} |
|
|
|