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

90 lines
2.3 KiB
Java
Raw Normal View History

2021-08-02 00:06:50 +08:00
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 ="JourneyWithWind")
public class SJourneyWithWind implements BaseConfig {
private int id;
private int activityId;
private int taskType;
private int[][] taskValue;
private int dayNum;
private int rewardId;
public static Map<Integer, SJourneyWithWind> config;
public static Map<Integer, List<SJourneyWithWind>> sTaskConfigByTypeMap;//<任务类型data>
public static Map<Integer, List<Integer>> sTaskConfigByDay;//<天数data>
@Override
public void init() throws Exception {
Map<Integer, SJourneyWithWind> configTmp = STableManager.getConfig( SJourneyWithWind.class);
Map<Integer, List<SJourneyWithWind>> configListTmp = new HashMap<>();
Map<Integer, List<Integer>> configListbyDay = new HashMap<>();
for(SJourneyWithWind sJourneyWithWind : configTmp.values()){
int taskType = sJourneyWithWind.getTaskType();
int day = sJourneyWithWind.getDayNum();
if(!configListTmp.containsKey(taskType)){
configListTmp.put(taskType,new ArrayList<>());
}
configListTmp.get(taskType).add(sJourneyWithWind);
if(!configListbyDay.containsKey(day)){
configListbyDay.put(day,new ArrayList<>());
}
configListbyDay.get(day).add(sJourneyWithWind.getId());
}
config = configTmp;
sTaskConfigByTypeMap = configListTmp;
sTaskConfigByDay = configListbyDay;
}
public static SJourneyWithWind getSDailyTasksConfigById(int missionId) {
return config.get(missionId);
}
public static List<SJourneyWithWind> getsTaskConfigByTypeMap(int missionType) {
return sTaskConfigByTypeMap.get(missionType);
}
public static List<Integer> getsTaskConfigByDay(int day) {
return sTaskConfigByDay.get(day);
}
public int getId() {
return id;
}
public int getActivityId() {
return activityId;
}
public int getTaskType() {
return taskType;
}
public int[][] getTaskValue() {
return taskValue;
}
public int getDayNum() {
return dayNum;
}
public int getRewardId() {
return rewardId;
}
}