miduo_server/tablemanager/src/main/java/config/SLotterySpecialConfig.java

97 lines
2.8 KiB
Java

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<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMap;
private static Map<Integer, List<SLotterySpecialConfig>> lotteryDifferentConfigMap;
@Override
public void init() throws Exception {
Map<Integer, SLotterySpecialConfig> config = STableManager.getConfig(SLotterySpecialConfig.class);
Map<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMapTmp = new HashMap<>();
Map<Integer, List<SLotterySpecialConfig>> 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<SLotterySpecialConfig> getLotterySpecialConfigListByType(int type) {
return lotterySpecialConfigMap.getOrDefault(type,null);
}
public static List<SLotterySpecialConfig> getLotteryListByDifferentType(int type) {
return lotteryDifferentConfigMap.getOrDefault(type,null);
}
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;
}
}