[代码完善](v2.5): v2.5 beta 修复角色修改菜单缓存问题

close #389
pull/394/head
ZhengJie 2020-06-06 18:47:49 +08:00
parent 00f7939d47
commit ca43526915
2 changed files with 3 additions and 17 deletions

View File

@ -106,20 +106,6 @@
</tr>
</table>
#### 特别鸣谢
- 感谢 [JetBrains](https://www.jetbrains.com/) 提供的非商业开源软件开发授权
- 感谢 [PanJiaChen](https://github.com/PanJiaChen/vue-element-admin) 大佬提供的前端模板
- 感谢 [Moxun](https://github.com/moxun1639) 大佬提供的前端 Curd 通用组件
- 感谢 [zhy6599](https://gitee.com/zhy6599) 大佬提供的后端运维管理相关功能
- 感谢 [j.yao.SUSE](https://github.com/everhopingandwaiting) 大佬提供的匿名接口与Redis限流等功能
- 感谢 [d15801543974](https://github.com/d15801543974) 大佬提供的基于注解的通用查询方式
#### 项目捐赠
项目的发展离不开你的支持,请作者喝杯咖啡吧☕ [Donate](https://el-admin.vip/donation/)

View File

@ -119,13 +119,13 @@ public class RoleServiceImpl implements RoleService {
@Override
public void updateMenu(Role resources, RoleDto roleDTO) {
Role role = roleMapper.toEntity(roleDTO);
// 清理缓存
List<User> users = userRepository.findByRoleId(role.getId());
Set<Long> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
redisUtils.delByKeys("menu::user:",userIds);
redisUtils.del("role::id:" + resources.getId());
// 更新菜单
role.setMenus(resources.getMenus());
// 清理缓存
redisUtils.delByKeys("menu::user:",userIds);
redisUtils.del("role::id:" + resources.getId());
roleRepository.save(role);
}