refactor(PayTypeEnum.java): 支付类型枚举优化继承IBaseEnum接口

This commit is contained in:
郝先瑞 2022-04-16 11:04:20 +08:00
parent a389cbd9ac
commit 9cb21396c7

View File

@ -1,41 +1,30 @@
package com.youlai.mall.oms.enums;
import com.youlai.common.base.IBaseEnum;
import lombok.Getter;
/**
* @author huawei
* @desc 订单来源类型枚举
* @desc 订单支付类型枚举
* @email huawei_code@163.com
* @date 2021/1/16
*/
public enum PayTypeEnum {
public enum PayTypeEnum implements IBaseEnum<Integer> {
WEIXIN_JSAPI(1,"微信JSAPI支付"),
WX_JSAPI(1, "微信JSAPI支付"),
ALIPAY(2, "支付宝支付"),
BALANCE(3, "会员余额支付"),
WEIXIN_APP(4,"微信APP支付");
WX_APP(4, "微信APP支付");
PayTypeEnum(int code, String text) {
this.code = code;
this.text = text;
PayTypeEnum(int value, String label) {
this.value = value;
this.label = label;
}
@Getter
private Integer code;
private Integer value;
@Getter
private String text;
public static PayTypeEnum getByCode(Integer code) {
PayTypeEnum payTypeEnum = null;
for (PayTypeEnum value : values()) {
if (value.getCode().equals(code)) {
payTypeEnum = value;
}
}
return payTypeEnum;
}
private String label;
}