public class ManageCache {
private static ManageCache instance;
/*
* 缓存的树状组织(方便给前台数据)
*/
private static Map<Integer,List<JSONObject>> companiesTree=new HashMap<>();
/*
* 缓存的组织ID key :用户Id value 对于的组织Id (key :org value 对应的组织Id ;key:porg value 对应的组织Id)
*/
private static Map<Integer,Map<String,List<Integer>>> companyOrgIdsAndPorgIds=new HashMap<>();
public static List<JSONObject> getCompaniesTree(Integer userId) {
return companiesTree.get(userId);
}
public static void setCompaniesTree(List<JSONObject> companiesTree,Integer userId) {
// 解析成树状的结构
ManageCache.companiesTree.put(userId,CommonUtil.buildCompanyTree(companiesTree));
}
public static Map<String, List<Integer>> getCompanyOrgIdsAndPorgIds(Integer userId) {
return companyOrgIdsAndPorgIds.get(userId);
}
public static void setCompanyOrgIdsAndPorgIds(Map<String, List<Integer>> companyOrgIdsAndPorgIds,Integer userId) {
ManageCache.companyOrgIdsAndPorgIds.put(userId,companyOrgIdsAndPorgIds);
}
public static ManageCache getInstance() {
return instance;
}
}