懒羊羊
2023-11-14 8286c62256f23bc2367a6729c0f46f84215e380b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package cn.stylefeng.guns.sys.core.util;
 
import java.math.BigDecimal;
import java.math.BigInteger;
 
/**
 * decimal变量获取
 *
 * @author fengshuonan
 * @date 2019-04-04-17:06
 */
public class DecimalUtil {
 
    /**
     * 获取object的值
     *
     * @author fengshuonan
     * @Date 2019-04-04 17:07
     */
    public static Long getLong(Object object) {
        if (object == null) {
            return null;
        }
        if (object instanceof BigDecimal) {
            return ((BigDecimal) object).longValue();
        }
        if (object instanceof BigInteger) {
            return ((BigInteger) object).longValue();
        }
        if (object instanceof Long) {
            return ((Long) object);
        }
        return null;
    }
 
}