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

56 lines
1.6 KiB
Java

package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="EquipSuiteConfig")
public class SEquipSuiteConfig implements BaseConfig {
private int id;
private int[][] suiteValue;
private Map<Integer,Map<Integer,Long>> suiteMap;
public static Map<Integer, SEquipSuiteConfig> config;
@Override
public void init() throws Exception {
Map<Integer, SEquipSuiteConfig> configTmp = STableManager.getConfig(SEquipSuiteConfig.class);
configTmp.values().forEach(item->{
Map<Integer,Map<Integer,Long>> suiteMapTmp = new HashMap<>();
int[][] suiteValue = item.getSuiteValue();
for(int[] suiteItem :suiteValue){
HashMap<Integer, Long> map = new HashMap<>();
map.putIfAbsent(suiteItem[1], (long) suiteItem[2]);
suiteMapTmp.put(suiteItem[0],map);
// suiteMapTmp.putIfAbsent(suiteItem[0],suiteMapTmp.getOrDefault(suiteItem[0],new HashMap<>(suiteMapTmp.getOrDefault(suiteItem[0]-1,new HashMap<>()))));
// suiteMapTmp.get(suiteItem[0]).put(suiteItem[1], suiteMapTmp.get(suiteItem[0]).getOrDefault(suiteItem[1],0) + suiteItem[2]);
}
item.setSuiteMap(suiteMapTmp);
});
config=configTmp;
}
public Map<Integer, Map<Integer, Long>> getSuiteMap() {
return suiteMap;
}
public void setSuiteMap(Map<Integer, Map<Integer, Long>> suiteMap) {
this.suiteMap = suiteMap;
}
public int getId() {
return id;
}
public int[][] getSuiteValue() {
return suiteValue;
}
}