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

67 lines
1.4 KiB
Java
Raw Normal View History

package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="PropertyConfig")
public class SPropertyConfig implements BaseConfig {
private int id;
private int propertyId;
private int style;
private float score;
private int targetPropertyId;
private int ifFormula;
private static Map<Integer,SPropertyConfig> sPropertyConfigByPIDMap;
@Override
public void init() throws Exception {
Map<Integer,SPropertyConfig> sPropertyConfigByPIDMapTmp = new HashMap<>();
Map<Integer, SPropertyConfig> config = STableManager.getConfig(SPropertyConfig.class);
for(SPropertyConfig sPropertyConfig : config.values()){
int propertyId = sPropertyConfig.getPropertyId();
sPropertyConfigByPIDMapTmp.put(propertyId,sPropertyConfig);
}
sPropertyConfigByPIDMap = sPropertyConfigByPIDMapTmp;
}
public static SPropertyConfig getsPropertyConfigByPID(int propertyId) {
return sPropertyConfigByPIDMap.get(propertyId);
}
public int getId() {
return id;
}
public int getPropertyId() {
return propertyId;
}
public int getStyle() {
return style;
}
public float getScore() {
return score;
}
public int getTargetPropertyId() {
return targetPropertyId;
}
public int getIfFormula() {
return ifFormula;
}
}