package config; import manager.STableManager; import manager.Table; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Table(name ="LotterySpecialConfig") public class SLotterySpecialConfig implements BaseConfig { private int id; private int differentType; private int type; private int count; private int min_num; private int max_num; private int pool_id; private int isNeedShow; private static Map> lotterySpecialConfigMap; private static Map> lotteryDifferentConfigMap; @Override public void init() throws Exception { Map config = STableManager.getConfig(SLotterySpecialConfig.class); Map> lotterySpecialConfigMapTmp = new HashMap<>(); Map> lotteryDifferentTypeMapTmp = new HashMap<>(); for(SLotterySpecialConfig sLotterySpecialConfig : config.values()){ // int differentType = sLotterySpecialConfig.getDifferentType(); // if(!lotterySpecialConfigMapTmp.containsKey(differentType)){ // lotterySpecialConfigMapTmp.put(differentType,new HashMap<>()); // } // int type = sLotterySpecialConfig.getType(); // if(!lotterySpecialConfigMapTmp.get(differentType).containsKey(type)){ // lotterySpecialConfigMapTmp.get(differentType).put(type,new ArrayList<>()); // } // lotterySpecialConfigMapTmp.get(differentType).get(type).add(sLotterySpecialConfig); lotterySpecialConfigMapTmp.computeIfAbsent(sLotterySpecialConfig.getType(),n->new ArrayList<>()).add(sLotterySpecialConfig); lotteryDifferentTypeMapTmp.computeIfAbsent(sLotterySpecialConfig.getDifferentType(),n->new ArrayList<>()).add(sLotterySpecialConfig); } lotterySpecialConfigMap = lotterySpecialConfigMapTmp; lotteryDifferentConfigMap = lotteryDifferentTypeMapTmp; } public static List getLotterySpecialConfigListByType(int type) { return lotterySpecialConfigMap.getOrDefault(type,null); } public static List getLotteryListByDifferentType(int type) { return lotteryDifferentConfigMap.getOrDefault(type,new ArrayList<>()); } public int getId() { return id; } public int getType() { return type; } public int getCount() { return count; } public int getMin_num() { return min_num; } public int getMax_num() { return max_num; } public int getpool_id() { return pool_id; } public int getDifferentType() { return differentType; } public int getIsNeedShow() { return isNeedShow; } }