From 982313135d1c239fe3b20e4c5664781f92d40aca Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Thu, 31 Jul 2025 17:17:39 +0800 Subject: [PATCH] Merge branch 'master' into xin --- oying-system/src/main/java/com/oying/modules/message/common/BizTypeEnum.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 58 insertions(+), 0 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/message/common/BizTypeEnum.java b/oying-system/src/main/java/com/oying/modules/message/common/BizTypeEnum.java new file mode 100644 index 0000000..d2f32e4 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/message/common/BizTypeEnum.java @@ -0,0 +1,58 @@ +package com.oying.modules.message.common; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum BizTypeEnum { + //业务类型 ORDER EVALUATION + ORDER("ORDER", "订单业务"), + EVALUATION("EVALUATION", "评价业务"); + + private final String key; + private final String value; + + /** + * 根据key获取枚举实例 + * @param key key值 + * @return 对应的枚举实例,未找到返回null + */ + public static BizTypeEnum getByKey(String key) { + if (key == null) { + return null; + } + for (BizTypeEnum typeEnum : BizTypeEnum.values()) { + if (typeEnum.key.equals(key)) { + return typeEnum; + } + } + return null; + } + + /** + * 根据value获取枚举实例 + * @param value value值 + * @return 对应的枚举实例,未找到返回null + */ + public static BizTypeEnum getByValue(String value) { + if (value == null) { + return null; + } + for (BizTypeEnum typeEnum : BizTypeEnum.values()) { + if (typeEnum.value.equals(value)) { + return typeEnum; + } + } + return null; + } + + @Override + public String toString() { + return "BizTypeEnum{" + + "key='" + key + '\'' + + ", value='" + value + '\'' + + ", name='" + this.name() + '\'' + + '}'; + } +} -- Gitblit v1.9.3