package enumeration.general;
|
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
|
public enum CheckScoreType {
|
CHECK_SCORE_TYPE_VIDEO(1, "视频考核"),
|
CHECK_SCORE_TYPE_CAR(2, "车辆考核"),
|
CHECK_SCORE_TYPE_FACE(3, "人脸考核");
|
|
@EnumValue
|
private final Integer value;
|
|
@JsonValue // 标明在转JSON时使用该字段
|
private final String desc;
|
|
CheckScoreType(Integer value, String desc) {
|
this.value = value;
|
this.desc = desc;
|
}
|
|
public Short getValue() {
|
return Short.valueOf(value+"");
|
}
|
|
public String getDesc() {
|
return desc;
|
}
|
|
// 根据value返回对应的枚举实例
|
public static CheckScoreType fromValue(int value) {
|
for (CheckScoreType type : CheckScoreType.values()) {
|
if (type.getValue() == value) {
|
return type;
|
}
|
}
|
throw new IllegalArgumentException("没有枚举值: " + value);
|
}
|
}
|