一、后端
java的Long类型是18位, js的Long类型是16位,所以会导致精度缺失
解决办法:
1)类型转化「Long to String」
2)
@JsonSerialize(using=ToStringSerializer.class)
private Long bankcardHash;
3) Jackson有个配置参数WRITE_NUMBERS_AS_STRINGS
,可以强制将所有数字全部转成字符串输出。其功能介绍为:Feature that forces all Java numbers to be written as JSON strings.
。使用方法很简单,只需要配置参数即可:
jackson:
generator:
write-numbers-as-strings: true