public enum TestEnum {
/**
* 用户-角色
*/
BTH("000", "测试"),
@Getter
private final String value;
@Getter
private final String text;
private SpztEnum(String value, String text) {
this.value = value;
this.text = text;
}
/**
* 获取权限类型。
* @param value 值。
* @return 存在时返回对象,否则返回 {@literal null} 。
*/
public static SpztEnum getPurviewType(String value) {
return Arrays.asList(SpztEnum.values())
.stream()
.filter(x -> x.getValue().equals(value))
.findFirst()
.orElse(null);
}
}
12-22
2955
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-25
7600
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)