1、组织套餐下的权限菜单id支持缓存、修改套餐内容或组织更换套餐时刷新对应缓存;2、增加组织套餐下菜单的过滤:登录系统展现菜单、接口权限串校验、角色管理给角色授权的可选菜单列表;

This commit is contained in:
gaoqr
2024-11-05 14:38:34 +08:00
parent e16583e3a8
commit eadb7f7633
16 changed files with 216 additions and 41 deletions
@@ -1,5 +1,6 @@
package com.cf.imes.framework.organ.core.redis;
import cn.hutool.core.text.CharSequenceUtil;
import com.cf.imes.framework.redis.core.TimeoutRedisCacheManager;
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
import lombok.extern.slf4j.Slf4j;
@@ -8,6 +9,9 @@ import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.cache.RedisCacheWriter;
import java.util.ArrayList;
import java.util.List;
/**
* 多组织的 {@link RedisCacheManager} 实现类
*
@@ -18,6 +22,13 @@ import org.springframework.data.redis.cache.RedisCacheWriter;
@Slf4j
public class OrganRedisCacheManager extends TimeoutRedisCacheManager {
// 不需要拼接组织id的redis-key列表
private static final List<String> ignoreOrganIdKeyList = new ArrayList<>();
static {
ignoreOrganIdKeyList.add("tenant_package_menu_ids");
}
public OrganRedisCacheManager(RedisCacheWriter cacheWriter,
RedisCacheConfiguration defaultCacheConfiguration) {
super(cacheWriter, defaultCacheConfiguration);
@@ -25,9 +36,14 @@ public class OrganRedisCacheManager extends TimeoutRedisCacheManager {
@Override
public Cache getCache(String name) {
// key带#代表设置了ttl,只保留#前的部分作为key
if (name.contains("#")) {
name = CharSequenceUtil.subBefore(name, "#", false);
}
// 如果开启多组织,则 name 拼接组织后缀
if (!OrganContextHolder.isIgnore()
&& OrganContextHolder.getOrganId() != null) {
&& OrganContextHolder.getOrganId() != null
&& !ignoreOrganIdKeyList.contains(name)) {
name = name + ":" + OrganContextHolder.getOrganId();
}