public enum CodeEnum {
TODO("1", "待办"),
DONE("2", "已办");
private String code;
private String value;
private CodeEnum(String code, String value) {
this.code = code;
this.value = value;
}
setter...
getter...
public static String getValueFromCode(String code) {
if(StringUtils.isNotEmpty(code)) {
for(CodeEnum codeEnum : CodeEnum.values()) {
result = codeEnum.getValue();
break;
}
}
return result;
}
}