From 606f1a8379cf9b3f588088819955bbbc07779889 Mon Sep 17 00:00:00 2001 From: smallchill Date: Sat, 11 Apr 2020 17:08:22 +0800 Subject: [PATCH] =?UTF-8?q?:heavy=5Fplus=5Fsign:=20=E6=87=92=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=8E=A5=E5=8F=A3=E6=96=B0=E5=A2=9E=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=89=80=E9=9C=80=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/DeptController.java | 13 ++++++++++--- .../system/controller/MenuController.java | 11 +++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java index e2d834e7..2c269ba1 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java @@ -29,12 +29,13 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.constant.RoleConstant; import org.springblade.core.tool.node.INode; +import org.springblade.core.tool.support.Kv; import org.springblade.core.tool.utils.Func; +import org.springblade.system.cache.DictCache; import org.springblade.system.entity.Dept; import org.springblade.system.service.IDeptService; import org.springblade.system.vo.DeptVO; import org.springblade.system.wrapper.DeptWrapper; -import org.springframework.cache.annotation.CacheEvict; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -131,8 +132,14 @@ public class DeptController extends BladeController { @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入dept") public R submit(@Valid @RequestBody Dept dept) { - CacheUtil.clear(SYS_CACHE); - return R.status(deptService.submit(dept)); + if (deptService.submit(dept)) { + CacheUtil.clear(SYS_CACHE); + // 返回懒加载树更新节点所需字段 + Kv kv = Kv.create().set("id", String.valueOf(dept.getId())).set("tenantId", dept.getTenantId()) + .set("deptCategoryName", DictCache.getValue("org_category", dept.getDeptCategory())); + return R.data(kv); + } + return R.fail("操作失败"); } /** diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java index 8cd1670d..54624a88 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/MenuController.java @@ -36,7 +36,6 @@ import org.springblade.system.vo.CheckedTreeVO; import org.springblade.system.vo.GrantTreeVO; import org.springblade.system.vo.MenuVO; import org.springblade.system.wrapper.MenuWrapper; -import org.springframework.cache.annotation.CacheEvict; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -45,7 +44,6 @@ import java.util.List; import java.util.Map; import static org.springblade.core.cache.constant.CacheConstant.MENU_CACHE; -import static org.springblade.core.cache.constant.CacheConstant.RESOURCE_CACHE; /** @@ -146,8 +144,13 @@ public class MenuController extends BladeController { @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入menu") public R submit(@Valid @RequestBody Menu menu) { - CacheUtil.clear(MENU_CACHE); - return R.status(menuService.submit(menu)); + if (menuService.submit(menu)) { + CacheUtil.clear(MENU_CACHE); + // 返回懒加载树更新节点所需字段 + Kv kv = Kv.create().set("id", String.valueOf(menu.getId())); + return R.data(kv); + } + return R.fail("操作失败"); }