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

55 lines
1.3 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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 ="WeekcardRotationConfig")
public class SWeekcardRotationConfig implements BaseConfig {
private int id;
private int[][] weekcardType;
private int globalActivity;
/**
* key活动id
*/
private static Map<Integer, List<SWeekcardRotationConfig>> map = new HashMap<>();
@Override
public void init() throws Exception {
Map<Integer, SWeekcardRotationConfig> config = STableManager.getConfig(SWeekcardRotationConfig.class);
HashMap<Integer, List<SWeekcardRotationConfig>> map1 = new HashMap<>();
for (SWeekcardRotationConfig value : config.values()) {
List<SWeekcardRotationConfig> list = map1.getOrDefault(value.getGlobalActivity(), new ArrayList<>());
list.add(value);
map1.put(value.getGlobalActivity(),list);
}
map.clear();
map = map1;
}
public static Map<Integer, List<SWeekcardRotationConfig>> getMap() {
return map;
}
public int getId() {
return id;
}
public int[][] getWeekcardType() {
return weekcardType;
}
public int getGlobalActivity() {
return globalActivity;
}
}