feat():增加系统字典校验
parent
6dd2f20dcb
commit
5c89c5cc49
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.common.core.enums;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
|
public enum SysPayType {
|
||||||
|
|
||||||
|
AlI_PAY("aliPay","支付宝"),
|
||||||
|
WECHAT_PAY("wechatPay","微信支付"),
|
||||||
|
JD_PAY("jdPay","京东支付");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
private final String info;
|
||||||
|
|
||||||
|
SysPayType(String code, String info) {
|
||||||
|
this.code = code;
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isCode(String code){
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.map(SysPayType::getCode)
|
||||||
|
.anyMatch(s -> s.equals(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getInfoByCode(String code) {
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.filter(s -> s.getCode().equals(code))
|
||||||
|
.findFirst()
|
||||||
|
.map(SysPayType::getInfo)
|
||||||
|
.orElseGet(()->"-");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue