mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-15 02:57:10 +08:00
优化:基于阿里巴巴 Java 开发手册(黄山版)优化 Jackson 超大整数配置
1.编程规约>前后端规约>第6条: 【强制】对于需要使用超大整数的场景,服务端一律使用 String 字符串类型返回,禁止使用 Long 类型。 说明:Java 服务端如果直接返回 Long 整型数据给前端,Javascript 会自动转换为 Number 类型(注:此类型为双精度浮点数,表示原理与取值范围等同于 Java 中的 Double)。Long 类型能表示的最大值是 263-1,在取值范围之内,超过 253(9007199254740992)的数值转化为Javascript 的 Number 时,有些数值会产生精度损失。 扩展说明,在 Long 取值范围内,任何 2 的指数次的整数都是绝对不会存在精度损失的,所以说精度损失是一个概率问题。若浮点数尾数位与指数位空间不限,则可以精确表示任何整数,但很不幸,双精度浮点数的尾数位只有 52 位。 反例:通常在订单号或交易号大于等于 16 位,大概率会出现前后端订单数据不一致的情况。比如,后端传输的 "orderId":362909601374617692,前端拿到的值却是:362909601374617660
This commit is contained in:
@@ -419,7 +419,7 @@
|
||||
deptIds: undefined,
|
||||
});
|
||||
const total = ref(0);
|
||||
const ids = ref<Array<number>>([]);
|
||||
const ids = ref<Array<string>>([]);
|
||||
const title = ref('');
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
@@ -494,7 +494,7 @@
|
||||
*
|
||||
* @param id ID
|
||||
*/
|
||||
const toUpdate = (id: number) => {
|
||||
const toUpdate = (id: string) => {
|
||||
reset();
|
||||
menuCheckStrictly.value = false;
|
||||
deptCheckStrictly.value = false;
|
||||
@@ -644,7 +644,7 @@
|
||||
*
|
||||
* @param id ID
|
||||
*/
|
||||
const toDetail = async (id: number) => {
|
||||
const toDetail = async (id: string) => {
|
||||
if (detailLoading.value) return;
|
||||
getMenuTree();
|
||||
getDeptTree();
|
||||
@@ -690,7 +690,7 @@
|
||||
*
|
||||
* @param ids ID 列表
|
||||
*/
|
||||
const handleDelete = (ids: Array<number>) => {
|
||||
const handleDelete = (ids: Array<string>) => {
|
||||
deleteRole(ids).then((res) => {
|
||||
proxy.$message.success(res.msg);
|
||||
getList();
|
||||
|
Reference in New Issue
Block a user