refactor: 优化刷新角色权限缓存,如果权限为空则不缓存
This commit is contained in:
@@ -52,7 +52,9 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
|||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
String roleCode = item.getRoleCode();
|
String roleCode = item.getRoleCode();
|
||||||
Set<String> perms = item.getPerms();
|
Set<String> perms = item.getPerms();
|
||||||
|
if (CollectionUtil.isNotEmpty(perms)) {
|
||||||
redisTemplate.opsForHash().put(SecurityConstants.ROLE_PERMS_PREFIX, roleCode, perms);
|
redisTemplate.opsForHash().put(SecurityConstants.ROLE_PERMS_PREFIX, roleCode, perms);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,9 +75,11 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
|||||||
}
|
}
|
||||||
|
|
||||||
Set<String> perms = rolePerms.getPerms();
|
Set<String> perms = rolePerms.getPerms();
|
||||||
|
if (CollectionUtil.isNotEmpty(perms)) {
|
||||||
redisTemplate.opsForHash().put(SecurityConstants.ROLE_PERMS_PREFIX, roleCode, perms);
|
redisTemplate.opsForHash().put(SecurityConstants.ROLE_PERMS_PREFIX, roleCode, perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新权限缓存 (角色编码变更时调用)
|
* 刷新权限缓存 (角色编码变更时调用)
|
||||||
|
|||||||
Reference in New Issue
Block a user