fix: 统一菜单缓存 key

This commit is contained in:
hxr
2023-12-16 14:31:00 +08:00
parent 09004fb89d
commit f32f4edc54
3 changed files with 3 additions and 3 deletions

View File

@@ -88,7 +88,6 @@ public class SysMenuController {
@Operation(summary = "删除菜单") @Operation(summary = "删除菜单")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@PreAuthorize("@ss.hasPerm('sys:menu:delete')") @PreAuthorize("@ss.hasPerm('sys:menu:delete')")
@CacheEvict(cacheNames = "system", key = "'routes'")
public Result deleteMenu( public Result deleteMenu(
@Parameter(description ="菜单ID多个以英文(,)分割") @PathVariable("id") Long id @Parameter(description ="菜单ID多个以英文(,)分割") @PathVariable("id") Long id
) { ) {

View File

@@ -197,7 +197,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
* 新增/修改菜单 * 新增/修改菜单
*/ */
@Override @Override
@CacheEvict(cacheNames = "menu", key = "'routes'",beforeInvocation = false) @CacheEvict(cacheNames = "menu", key = "'routes'")
public boolean saveMenu(MenuForm menuForm) { public boolean saveMenu(MenuForm menuForm) {
String path = menuForm.getPath(); String path = menuForm.getPath();
MenuTypeEnum menuType = menuForm.getType(); MenuTypeEnum menuType = menuForm.getType();
@@ -245,6 +245,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
* @return * @return
*/ */
@Override @Override
@CacheEvict(cacheNames = "menu", key = "'routes'")
public boolean updateMenuVisible(Long menuId, Integer visible) { public boolean updateMenuVisible(Long menuId, Integer visible) {
return this.update(new LambdaUpdateWrapper<SysMenu>() return this.update(new LambdaUpdateWrapper<SysMenu>()
.eq(SysMenu::getId, menuId) .eq(SysMenu::getId, menuId)

View File

@@ -191,7 +191,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
*/ */
@Override @Override
@Transactional @Transactional
@CacheEvict(cacheNames = "system", key = "'routes'") @CacheEvict(cacheNames = "menu", key = "'routes'")
public boolean assignMenusToRole(Long roleId, List<Long> menuIds) { public boolean assignMenusToRole(Long roleId, List<Long> menuIds) {
// 删除角色菜单 // 删除角色菜单
roleMenuService.remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId)); roleMenuService.remove(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId));