From 995ddf6d98a98ead307b7fd822758c4160e98427 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期六, 27 一月 2024 00:51:50 +0800 Subject: [PATCH] add 新增 用户、部门、角色、岗位 下拉选接口与代码实现优化 --- ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MessageUtils.java | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MessageUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MessageUtils.java index 6f3729b..48dfc08 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MessageUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MessageUtils.java @@ -3,6 +3,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.springframework.context.MessageSource; +import org.springframework.context.NoSuchMessageException; import org.springframework.context.i18n.LocaleContextHolder; /** @@ -23,6 +24,10 @@ * @return 鑾峰彇鍥介檯鍖栫炕璇戝�� */ public static String message(String code, Object... args) { - return MESSAGE_SOURCE.getMessage(code, args, LocaleContextHolder.getLocale()); + try { + return MESSAGE_SOURCE.getMessage(code, args, LocaleContextHolder.getLocale()); + } catch (NoSuchMessageException e) { + return code; + } } } -- Gitblit v1.9.3