From 8d4636cc30e093fb7526cb75180eee10c5b8281f Mon Sep 17 00:00:00 2001 From: fhx <308050795@qq.com> Date: 星期五, 20 九月 2024 18:47:18 +0800 Subject: [PATCH] Merge branch 'master-stander' into master-jiayan --- src/main/java/com/hx/util/MapUtil.java | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hx/util/MapUtil.java b/src/main/java/com/hx/util/MapUtil.java index 1fba6e0..392bae2 100644 --- a/src/main/java/com/hx/util/MapUtil.java +++ b/src/main/java/com/hx/util/MapUtil.java @@ -35,12 +35,12 @@ */ public static int getInt(Map<String, Object> map, String key) { - if(map == null || StringUtils.isEmpty(key)) + if(map == null || StringUtils.isEmpty(key) || null == map.get(key) || StringUtils.isEmpty(map.get(key).toString())) { return -1; } - return null == map.get(key) ? -1 : Integer.parseInt(map.get(key).toString()); + return Integer.parseInt(map.get(key).toString()); } /** @@ -51,12 +51,12 @@ */ public static int getIntZero(Map<String, Object> map, String key) { - if(map == null || StringUtils.isEmpty(key)) + if(map == null || StringUtils.isEmpty(key) || null == map.get(key) || StringUtils.isEmpty(map.get(key).toString())) { return 0; } - return null == map.get(key) ? 0 : Integer.parseInt(map.get(key).toString()); + return Integer.parseInt(map.get(key).toString()); } /** -- Gitblit v1.8.0