mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 18:45:57 +08:00
update 忽略租户在controller层,移除service包含
This commit is contained in:
parent
716d7e7435
commit
9782e8680f
@ -15,7 +15,6 @@ import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
@ -57,10 +56,10 @@ public class TenantHelper {
|
||||
*
|
||||
* @param handle 处理执行方法
|
||||
*/
|
||||
public static void ignore(Consumer<Void> handle) {
|
||||
public static void ignore(Runnable handle) {
|
||||
enableIgnore();
|
||||
try {
|
||||
handle.accept(null);
|
||||
handle.run();
|
||||
} finally {
|
||||
disableIgnore();
|
||||
}
|
||||
|
||||
@ -3,6 +3,11 @@ package org.dromara.system.controller.system;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
||||
import com.baomidou.lock.annotation.Lock4j;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.TenantConstants;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
@ -18,13 +23,15 @@ import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.bo.SysTenantBo;
|
||||
import org.dromara.system.domain.vo.SysTenantVo;
|
||||
import org.dromara.system.service.ISysTenantService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -89,7 +96,7 @@ public class SysTenantController extends BaseController {
|
||||
if (!tenantService.checkCompanyNameUnique(bo)) {
|
||||
return R.fail("新增租户'" + bo.getCompanyName() + "'失败,企业名称已存在");
|
||||
}
|
||||
return toAjax(tenantService.insertByBo(bo));
|
||||
return toAjax(TenantHelper.ignore(() -> tenantService.insertByBo(bo)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,7 +175,7 @@ public class SysTenantController extends BaseController {
|
||||
@Log(title = "租户", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/syncTenantPackage")
|
||||
public R<Void> syncTenantPackage(@NotBlank(message = "租户ID不能为空") String tenantId, @NotBlank(message = "套餐ID不能为空") String packageId) {
|
||||
return toAjax(tenantService.syncTenantPackage(tenantId, packageId));
|
||||
return toAjax(TenantHelper.ignore(() -> tenantService.syncTenantPackage(tenantId, packageId)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.tenant.helper.TenantHelper;
|
||||
import org.dromara.system.domain.*;
|
||||
import org.dromara.system.domain.bo.SysTenantBo;
|
||||
import org.dromara.system.domain.vo.SysTenantVo;
|
||||
@ -113,8 +112,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(SysTenantBo bo) {
|
||||
TenantHelper.ignore(unused -> {
|
||||
|
||||
SysTenant add = MapstructUtils.convert(bo, SysTenant.class);
|
||||
|
||||
// 获取所有租户编号
|
||||
@ -185,7 +182,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
config.setTenantId(tenantId);
|
||||
}
|
||||
configMapper.insertBatch(sysConfigList);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -342,7 +338,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean syncTenantPackage(String tenantId, String packageId) {
|
||||
TenantHelper.ignore(unused -> {
|
||||
SysTenantPackage tenantPackage = tenantPackageMapper.selectById(packageId);
|
||||
List<SysRole> roles = roleMapper.selectList(
|
||||
new LambdaQueryWrapper<SysRole>().eq(SysRole::getTenantId, tenantId));
|
||||
@ -367,7 +362,6 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
||||
roleMenuMapper.delete(
|
||||
new LambdaQueryWrapper<SysRoleMenu>().in(SysRoleMenu::getRoleId, roleIds).notIn(!menuIds.isEmpty(), SysRoleMenu::getMenuId, menuIds));
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user