package com.ruoyi.common.core.enums;
|
|
import com.baomidou.mybatisplus.annotation.EnumValue;
|
import com.fasterxml.jackson.annotation.JsonValue;
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
|
@Getter
|
@AllArgsConstructor
|
public enum AuthenticationEnum {
|
|
/*实名认证 0=不需实名 1=需要实名*/
|
|
NO_REAL_NAME_REQUIRED(0, "不需实名"),
|
REAL_NAME_REQUIRED(1, "需要实名");
|
@EnumValue
|
private final int code;
|
@JsonValue
|
private final String desc;
|
|
|
/**
|
* 通过code获取枚举
|
*
|
* @param code
|
* @return
|
*/
|
public static AuthenticationEnum fromCode(Integer code) {
|
AuthenticationEnum[] resultTypes = AuthenticationEnum.values();
|
for (AuthenticationEnum resultType : resultTypes) {
|
if (code.equals(resultType.getCode())) {
|
return resultType;
|
}
|
}
|
return null;
|
}
|
|
}
|