From 32a1ddb924a5a58086255e082bdecb3ef65da41b Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期三, 08 十一月 2023 11:03:00 +0800 Subject: [PATCH] 查看数据 --- src/main/java/com/hx/util/MapUtil.java | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/MapUtil.java b/src/main/java/com/hx/util/MapUtil.java index 22ae85c..1fba6e0 100644 --- a/src/main/java/com/hx/util/MapUtil.java +++ b/src/main/java/com/hx/util/MapUtil.java @@ -1,5 +1,6 @@ package com.hx.util; +import java.math.BigDecimal; import java.util.Map; /** @@ -57,4 +58,36 @@ return null == map.get(key) ? 0 : Integer.parseInt(map.get(key).toString()); } + + /** + * 浠巑ap涓幏鍙栨暟瀛楃被鍨嬪璞� + * @param map + * @param key + * @return + */ + public static BigDecimal getBigDecimal(Map<String, Object> map, String key) + { + if(map == null || StringUtils.isEmpty(key)) + { + return BigDecimal.ZERO; + } + + return null == map.get(key) ? BigDecimal.ZERO : new BigDecimal(map.get(key).toString()); + } + + /** + * 鑾峰彇娴偣鏁帮紝榛樿杩斿洖0 + * @param map + * @param key + * @return + */ + public static Double getDoubleZero(Map<String, Object> map, String key) + { + if(map == null || StringUtils.isEmpty(key)) + { + return 0D; + } + + return null == map.get(key) ? 0D : Double.parseDouble(map.get(key).toString()); + } } -- Gitblit v1.8.0