Introducing new features. 支持清除菜单缓存

This commit is contained in:
lishangbu 2021-12-31 21:15:29 +08:00
parent 393ab9add1
commit e04698d1dc
4 changed files with 22 additions and 5 deletions

View File

@ -59,9 +59,4 @@ public interface CacheConstants {
*/ */
String CLIENT_DETAILS_KEY = "pig_oauth:client:details"; String CLIENT_DETAILS_KEY = "pig_oauth:client:details";
/**
* 参数缓存
*/
String PARAMS_DETAILS = "params_details";
} }

View File

@ -125,4 +125,15 @@ public class MenuController {
return R.ok(sysMenuService.updateMenuById(sysMenu)); return R.ok(sysMenuService.updateMenuById(sysMenu));
} }
/**
* 清除菜单缓存
*/
@SysLog("清除菜单缓存")
@DeleteMapping("/cache")
@PreAuthorize("@pms.hasPermission('sys_menu_del')")
public R clearMenuCache() {
sysMenuService.clearMenuCache();
return R.ok();
}
} }

View File

@ -70,4 +70,9 @@ public interface SysMenuService extends IService<SysMenu> {
*/ */
List<Tree<Long>> filterMenu(Set<SysMenu> menuSet, Long parentId); List<Tree<Long>> filterMenu(Set<SysMenu> menuSet, Long parentId);
/**
* 清除菜单缓存
*/
void clearMenuCache();
} }

View File

@ -132,6 +132,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
return TreeUtil.build(collect, parent); return TreeUtil.build(collect, parent);
} }
@Override
@CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true)
public void clearMenuCache() {
}
@NotNull @NotNull
private Function<SysMenu, TreeNode<Long>> getNodeFunction() { private Function<SysMenu, TreeNode<Long>> getNodeFunction() {
return menu -> { return menu -> {