Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gson 数字 转换成科学计数法 问题 #217

Open
jinzugui opened this issue Nov 16, 2023 · 0 comments
Open

Gson 数字 转换成科学计数法 问题 #217

jinzugui opened this issue Nov 16, 2023 · 0 comments

Comments

@jinzugui
Copy link

版本情况

JDK版本: jdk_1.8.0_261
erupt版本: 1.10.8

问题描述

页面查询使用id ,数字超过 10000000 会转换成科学计数法 ,导致查询报错

image
image

原因 (猜测)

默认接受查询条件的值 xyz.erupt.annotation.query.Condition#value 类型为Object ,
image
所以gson 会使用 ObjectTypeAdapter 转换,默认数值类型转换成了double,double 值超过一定范围就会使用科学计数法。
image

感觉可以在 xyz.erupt.core.config.GsonFactory 做点改变 或者给个扩展,能让开发自定义一些 TypeAdapter
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant