diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java index 2e5b4230..0756b9fe 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/TenantController.java @@ -23,7 +23,6 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.*; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.BladeUser; @@ -43,8 +42,6 @@ import java.util.Date; import java.util.List; import java.util.Map; -import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; - /** * 控制器 * @@ -122,7 +119,6 @@ public class TenantController extends BladeController { @ApiOperation(value = "新增或修改", notes = "传入tenant") @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) public R submit(@Valid @RequestBody Tenant tenant) { - CacheUtil.clear(SYS_CACHE); return R.status(tenantService.submitTenant(tenant)); } @@ -135,7 +131,6 @@ public class TenantController extends BladeController { @ApiOperation(value = "逻辑删除", notes = "传入ids") @PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - CacheUtil.clear(SYS_CACHE); return R.status(tenantService.removeTenant(Func.toLongList(ids))); } diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java index 8f7e98d4..c187b7c4 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/service/impl/TenantServiceImpl.java @@ -79,6 +79,7 @@ public class TenantServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public boolean submitTenant(Tenant tenant) { + CacheUtil.clear(SYS_CACHE); if (Func.isEmpty(tenant.getId())) { List tenants = baseMapper.selectList(Wrappers.query().lambda().eq(Tenant::getIsDeleted, BladeConstant.DB_NOT_DELETED)); List codes = tenants.stream().map(Tenant::getTenantId).collect(Collectors.toList()); @@ -164,6 +165,7 @@ public class TenantServiceImpl extends BaseServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public boolean removeTenant(List ids) { + CacheUtil.clear(SYS_CACHE); List tenantList = this.list(Wrappers.query().lambda().in(Tenant::getId, ids)); List tenantIds = tenantList.stream().map(tenant -> Func.toStr(tenant.getTenantId())).distinct().collect(Collectors.toList()); if (tenantIds.contains(BladeConstant.ADMIN_TENANT_ID)) {