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 = "删除菜单")
@DeleteMapping("/{id}")
@PreAuthorize("@ss.hasPerm('sys:menu:delete')")
@CacheEvict(cacheNames = "system", key = "'routes'")
public Result deleteMenu(
@Parameter(description ="菜单ID多个以英文(,)分割") @PathVariable("id") Long id
) {

View File

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

View File

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