From e9af9f5cfeddbe5c0b33a3060b8ea6364c51e744 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期五, 15 十一月 2024 11:37:10 +0800 Subject: [PATCH] 白名单故障类型 --- ycl-common/src/main/java/enumeration/ErrorType.java | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/ycl-common/src/main/java/enumeration/ErrorType.java b/ycl-common/src/main/java/enumeration/ErrorType.java index 43630c1..88fed87 100644 --- a/ycl-common/src/main/java/enumeration/ErrorType.java +++ b/ycl-common/src/main/java/enumeration/ErrorType.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.annotation.EnumValue; import lombok.Getter; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -69,4 +70,31 @@ .filter(errorType -> errorType.getCategory() == category) .collect(Collectors.toList()); } + + // 鏍规嵁value鑾峰彇desc + public static List<String> getDescriptionList() { + List<String> list = new ArrayList<>(); + for (ErrorType errorType : ErrorType.values()) { + list.add(errorType.getDesc()); + } + return list; + } + // 鏍规嵁value鑾峰彇desc + public static String getDescriptionByValue(String value) { + for (ErrorType errorType : ErrorType.values()) { + if (errorType.getValue().equals(value)) { + return errorType.getDesc(); + } + } + return null; + } + // 鏍规嵁desc鑾峰彇value + public static String getValueByDescription(String desc) { + for (ErrorType errorType : ErrorType.values()) { + if (errorType.getDesc().equals(desc)) { + return errorType.getValue(); + } + } + return null; + } } -- Gitblit v1.8.0