mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、组织套餐下的权限菜单id支持缓存、修改套餐内容或组织更换套餐时刷新对应缓存;2、增加组织套餐下菜单的过滤:登录系统展现菜单、接口权限串校验、角色管理给角色授权的可选菜单列表;
This commit is contained in:
+17
-1
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user