package com.gk.firework.Domain.Enum; import com.fasterxml.jackson.annotation.JsonValue; import java.io.Serializable; public enum CertificatePersonType { DRIVER("DRIVER", "驾驶员"), ESCORT("ESCORT", "押运员"),; private String code; private String msg; CertificatePersonType(String code, String msg) { this.code = code; this.msg = msg; } public String getCode() { return code; } @JsonValue public String getMsg() { return msg; } public static CertificatePersonType parse(String code){ for(CertificatePersonType cs:CertificatePersonType.values()){ if(cs.getCode().equals(code)){ return cs; } } return null; } }