将广播设备写死的代码配置化

yun-zuoyi
crish 6 years ago
parent 51d70654ef
commit f836daf8a6

@ -11,6 +11,51 @@ import org.apache.commons.lang3.StringUtils;
* @Modify:
**/
public class AndonEnumUtil {
/**
*
* 10-20-
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ANDON_CONFIG_GROUP {
BROAD_GROUP(10,"广播配置分组");
private int value;
private String description;
ANDON_CONFIG_GROUP(int value, String description) {
this.value = value;
this.description = description;
}
public int getValue() {
return value;
}
public String getDescription() {
return description;
}
public static String valueOfDescription(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public static int descriptionOfValue(String val) {
int tmp = -1;
for (int i = 0; i < values().length; i++) {
if (StringUtils.equalsIgnoreCase(values()[i].description, val)) {
tmp = values()[i].value;
}
}
return tmp;
}
}
/**
*
*

Loading…
Cancel
Save