|
|
@@ -0,0 +1,45 @@ |
|
|
|
package cc.smtweb.system.bpm.web.sys.user.menuPlan; |
|
|
|
|
|
|
|
import cc.smtweb.framework.core.cache.SessionCacheFactory; |
|
|
|
import cc.smtweb.framework.core.util.CommUtil; |
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author: tanghp |
|
|
|
* @Date: 2022-09-26 11:12 |
|
|
|
* @Desc: 菜单明细加载类 |
|
|
|
*/ |
|
|
|
public class MenuPlanItemProvider { |
|
|
|
private volatile MenuPlanItemProvider provider; |
|
|
|
private Map<Long, MenuPlanItem> map = new HashMap<>(); |
|
|
|
private MenuPlanItemProvider() { |
|
|
|
} |
|
|
|
public MenuPlanItemProvider getInstance(){ |
|
|
|
if (provider == null) { |
|
|
|
synchronized (SessionCacheFactory.class) { |
|
|
|
if (provider == null) { |
|
|
|
provider = new MenuPlanItemProvider(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return provider; |
|
|
|
} |
|
|
|
// 获取菜单方案明细ID |
|
|
|
public MenuPlanItem getMenuPlanItem(long menuId){ |
|
|
|
MenuPlanItem menuPlanItem = map.get(menuId); |
|
|
|
if(menuPlanItem!=null)return menuPlanItem; |
|
|
|
Collection<MenuPlan> plans = MenuPlanCache.getInstance().getAll(); |
|
|
|
if(CommUtil.isEmpty(plans))return null; |
|
|
|
for(MenuPlan menuPlan: plans){ |
|
|
|
menuPlanItem = MenuPlanCache.getInstance().getById(menuPlan.getEntityId(),menuId); |
|
|
|
if(menuPlanItem!=null){ |
|
|
|
map.put(menuId,menuPlanItem); |
|
|
|
return menuPlanItem; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |