package com.glxp.api.util; import cn.hutool.core.util.StrUtil; import java.math.BigDecimal; public class IntUtil { public static int value(Integer value) { if (value == null) return 0; else return value.intValue(); } public static BigDecimal value(BigDecimal value) { if (value == null) return new BigDecimal(0); else return value; } public static long value(Long value) { if (value == null) return 0l; else return value.longValue(); } public static boolean value(Boolean value) { if (value == null) return false; else return value; } public static int value(String value) { if (StrUtil.isEmpty(value)) return 0; else return Integer.parseInt(value); } public static int value(Integer value, int defaultValue) { if (value != null && value != 0) return value; else return defaultValue; } public static int value(String value, int defaultValue) { if (StrUtil.isEmpty(value) || "0".equals(value)) return defaultValue; else return Integer.parseInt(value); } }