mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
refactor(PayTypeEnum.java): 支付类型枚举优化继承IBaseEnum接口
This commit is contained in:
parent
a389cbd9ac
commit
9cb21396c7
@ -1,41 +1,30 @@
|
|||||||
package com.youlai.mall.oms.enums;
|
package com.youlai.mall.oms.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.youlai.common.base.IBaseEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author huawei
|
* @author huawei
|
||||||
* @desc 订单来源类型枚举
|
* @desc 订单支付类型枚举
|
||||||
* @email huawei_code@163.com
|
* @email huawei_code@163.com
|
||||||
* @date 2021/1/16
|
* @date 2021/1/16
|
||||||
*/
|
*/
|
||||||
public enum PayTypeEnum {
|
public enum PayTypeEnum implements IBaseEnum<Integer> {
|
||||||
|
|
||||||
WEIXIN_JSAPI(1,"微信JSAPI支付"),
|
WX_JSAPI(1, "微信JSAPI支付"),
|
||||||
ALIPAY(2,"支付宝支付"),
|
ALIPAY(2, "支付宝支付"),
|
||||||
BALANCE(3,"会员余额支付"),
|
BALANCE(3, "会员余额支付"),
|
||||||
WEIXIN_APP(4,"微信APP支付");
|
WX_APP(4, "微信APP支付");
|
||||||
|
|
||||||
PayTypeEnum(int code, String text) {
|
PayTypeEnum(int value, String label) {
|
||||||
this.code = code;
|
this.value = value;
|
||||||
this.text = text;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Integer code;
|
private Integer value;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private String text;
|
private String label;
|
||||||
|
|
||||||
public static PayTypeEnum getByCode(Integer code) {
|
|
||||||
PayTypeEnum payTypeEnum = null;
|
|
||||||
|
|
||||||
for (PayTypeEnum value : values()) {
|
|
||||||
if (value.getCode().equals(code)) {
|
|
||||||
payTypeEnum = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return payTypeEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user