public enum TypeEnum {
/**
* 支付方式枚举
*/
CASHPAY(1, "现金"),
ALIPAY(2, "支付宝"),
private int code;
private String desc;
TypeEnum(int code, String desc) {
this.code = code;
this.desc = desc;
}
public int getCode() {
return code;
}
public String getDesc() {
return desc;
}
public static String getDescByCode(Integer code){
if (code == null){
return null;
}
for (TypeEnum orderStatusEnum : TypeEnum.values()){
if (code.equals(orderStatusEnum.code)){
return orderStatusEnum.desc;
}
}
return null;
}
}
枚举类创建
最新推荐文章于 2024-03-19 11:32:46 发布