1.首先我们需要一个枚举的基类
public interface BaseEnum{
Integer getCode();
String getValue();
String getLabel();
}
2.然后再写具体的枚举类
public enum HotTypeEnum implements BaseEnum{
LOW_HOT(0,"LOW_HOT","低温"),
MIDDLE_HOT(1,"MIDDLE_HOT","中温"),
HIGH_HOT(2,"HIGH_HOT","高温");
//code 编码
private final Integer code;
//value 值
private final String value;
//label
private final String label;
HotTypeEnum(Integer code,String value,String label){
this.code = code;
this.value = value;
this.label = label;
}
public Integer getCode(){ return code; }
public Integer getValue(){ return value; }
public Integer getLabel(){ return label; }
}