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

55 lines
1.3 KiB
Java
Raw Normal View History

2021-11-01 13:18:29 +08:00
package config;
import manager.STableManager;
import manager.Table;
2022-05-31 17:13:59 +08:00
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
2021-11-01 13:18:29 +08:00
import java.util.Map;
@Table(name ="WeekcardRotationConfig")
public class SWeekcardRotationConfig implements BaseConfig {
private int id;
private int[][] weekcardType;
2022-05-31 17:13:59 +08:00
private int globalActivity;
2021-11-01 13:18:29 +08:00
2022-05-31 17:13:59 +08:00
/**
* keyid
*/
private static Map<Integer, List<SWeekcardRotationConfig>> map = new HashMap<>();
2021-11-01 13:18:29 +08:00
@Override
public void init() throws Exception {
2022-05-31 17:13:59 +08:00
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;
2021-11-01 13:18:29 +08:00
}
2022-05-31 17:13:59 +08:00
public static Map<Integer, List<SWeekcardRotationConfig>> getMap() {
return map;
}
2021-11-01 13:18:29 +08:00
2022-05-31 17:13:59 +08:00
public int getId() {
2021-11-01 13:18:29 +08:00
return id;
}
public int[][] getWeekcardType() {
return weekcardType;
}
2022-05-31 17:13:59 +08:00
public int getGlobalActivity() {
return globalActivity;
2021-11-01 13:18:29 +08:00
}
}