Java小错误集合

1.  java.lang.Long cannot be cast to java.math.BigInteger

不能强制转换,即

BigInteger orderno = (BigInteger)orderdata.get("orderno") ;

可以用这种方法转换

BigInteger orderno = BigInteger.valueOf((Long) orderdata.get("orderno")) ;

2. Map集合的数据不能更改。

用map1集合接收数据库传数过来的数据是不能在map1中更改的,可以新写一个Map2然后addAll把所有的map1的数据传输进去,然后在map2中进行数据的更改。

3. 数据传到前端精度丢失

从数据库获取的bigInteger的数据使用bigInteger接收并传到前端时,会出现精度丢失的问题,数据的后两位全部变成0。最好是把传给前端的数据都变成Sting类型,防止精度丢失,也方便前端操作。

 

猜你喜欢

转载自blog.csdn.net/hglfs/article/details/84553910