From 0df24c7f8afe5a4764b7876c863e4cd10ea7934a Mon Sep 17 00:00:00 2001 From: guang <guang@guang.com> Date: 星期五, 15 九月 2023 16:21:48 +0800 Subject: [PATCH] 增加maputil的方法 --- src/main/java/com/hx/util/MapUtil.java | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/MapUtil.java b/src/main/java/com/hx/util/MapUtil.java index 81ad5a6..22ae85c 100644 --- a/src/main/java/com/hx/util/MapUtil.java +++ b/src/main/java/com/hx/util/MapUtil.java @@ -41,4 +41,20 @@ return null == map.get(key) ? -1 : Integer.parseInt(map.get(key).toString()); } + + /** + * 浠巑ap涓幏鍙栨暣鏁帮紝濡傛灉娌℃湁锛屽垯杩斿洖0 + * @param map + * @param key + * @return + */ + public static int getIntZero(Map<String, Object> map, String key) + { + if(map == null || StringUtils.isEmpty(key)) + { + return 0; + } + + return null == map.get(key) ? 0 : Integer.parseInt(map.get(key).toString()); + } } -- Gitblit v1.8.0