mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-24 17:00:54 +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:
@@ -4,7 +4,7 @@ import qs from 'query-string';
|
||||
const BASE_URL = '/monitor/log';
|
||||
|
||||
export interface LogRecord {
|
||||
logId?: number;
|
||||
logId?: string;
|
||||
clientIp: string;
|
||||
location: string;
|
||||
browser: string;
|
||||
@@ -65,7 +65,7 @@ export interface OperationLogParam extends Partial<OperationLogRecord> {
|
||||
page: number;
|
||||
size: number;
|
||||
sort: Array<string>;
|
||||
uid?: number;
|
||||
uid?: string;
|
||||
}
|
||||
|
||||
export interface OperationLogListRes {
|
||||
@@ -102,6 +102,6 @@ export function listSystemLog(params: SystemLogParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getSystemLog(logId: number) {
|
||||
return axios.get<SystemLogDetailRecord>(`${BASE_URL}/system/${logId}`);
|
||||
export function getSystemLog(id: string) {
|
||||
return axios.get<SystemLogDetailRecord>(`${BASE_URL}/system/${id}`);
|
||||
}
|
||||
|
@@ -4,9 +4,9 @@ import qs from 'query-string';
|
||||
const BASE_URL = '/system/dept';
|
||||
|
||||
export interface DeptRecord {
|
||||
deptId?: number;
|
||||
deptId?: string;
|
||||
deptName: string;
|
||||
parentId?: number;
|
||||
parentId?: string;
|
||||
description?: string;
|
||||
deptSort: number;
|
||||
status?: number;
|
||||
@@ -32,7 +32,7 @@ export function listDept(params: DeptParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getDept(id: number) {
|
||||
export function getDept(id: string) {
|
||||
return axios.get<DeptRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,6 @@ export function updateDept(req: DeptRecord) {
|
||||
return axios.put(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function deleteDept(ids: number | Array<number>) {
|
||||
export function deleteDept(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@@ -4,9 +4,9 @@ import qs from 'query-string';
|
||||
const BASE_URL = '/system/menu';
|
||||
|
||||
export interface MenuRecord {
|
||||
menuId?: number;
|
||||
menuId?: string;
|
||||
menuName: string;
|
||||
parentId?: number;
|
||||
parentId?: string;
|
||||
menuType: number;
|
||||
path?: string;
|
||||
name?: string;
|
||||
@@ -40,7 +40,7 @@ export function listMenu(params: MenuParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getMenu(id: number) {
|
||||
export function getMenu(id: string) {
|
||||
return axios.get<MenuRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,6 @@ export function updateMenu(req: MenuRecord) {
|
||||
return axios.put(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function deleteMenu(ids: number | Array<number>) {
|
||||
export function deleteMenu(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@@ -4,14 +4,14 @@ import qs from 'query-string';
|
||||
const BASE_URL = '/system/role';
|
||||
|
||||
export interface RoleRecord {
|
||||
roleId?: number;
|
||||
roleId?: string;
|
||||
roleName: string;
|
||||
roleCode?: string;
|
||||
roleSort?: number;
|
||||
description?: string;
|
||||
menuIds?: Array<number>;
|
||||
menuIds?: Array<string>;
|
||||
dataScope: number;
|
||||
deptIds?: Array<number>;
|
||||
deptIds?: Array<string>;
|
||||
status?: number;
|
||||
createUserString?: string;
|
||||
createTime?: string;
|
||||
@@ -42,7 +42,7 @@ export function listRole(params: RoleParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getRole(id: number) {
|
||||
export function getRole(id: string) {
|
||||
return axios.get<RoleRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,6 @@ export function updateRole(req: RoleRecord) {
|
||||
return axios.put(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function deleteRole(ids: number | Array<number>) {
|
||||
export function deleteRole(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import qs from 'query-string';
|
||||
const BASE_URL = '/system/user';
|
||||
|
||||
export interface UserRecord {
|
||||
userId?: number;
|
||||
userId?: string;
|
||||
username: string;
|
||||
nickname: string;
|
||||
gender: number;
|
||||
@@ -17,9 +17,9 @@ export interface UserRecord {
|
||||
createTime?: string;
|
||||
updateUserString?: string;
|
||||
updateTime?: string;
|
||||
deptId?: number;
|
||||
deptId?: string;
|
||||
deptName?: string;
|
||||
roleIds?: Array<number>;
|
||||
roleIds?: Array<string>;
|
||||
roleNames?: Array<string>;
|
||||
disabled?: boolean;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export function listUser(params: UserParam) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getUser(id: number) {
|
||||
export function getUser(id: string) {
|
||||
return axios.get<UserRecord>(`${BASE_URL}/${id}`);
|
||||
}
|
||||
|
||||
@@ -59,18 +59,18 @@ export function updateUser(req: UserRecord) {
|
||||
return axios.put(BASE_URL, req);
|
||||
}
|
||||
|
||||
export function deleteUser(ids: number | Array<number>) {
|
||||
export function deleteUser(ids: string | Array<string>) {
|
||||
return axios.delete(`${BASE_URL}/${ids}`);
|
||||
}
|
||||
|
||||
export function resetPassword(id: number) {
|
||||
export function resetPassword(id: string) {
|
||||
return axios.patch(`${BASE_URL}/${id}/password`);
|
||||
}
|
||||
|
||||
export interface UpdateUserRoleReq {
|
||||
roleIds?: Array<number>;
|
||||
roleIds?: Array<string>;
|
||||
}
|
||||
|
||||
export function updateUserRole(req: UpdateUserRoleReq, id: number) {
|
||||
export function updateUserRole(req: UpdateUserRoleReq, id: string) {
|
||||
return axios.patch(`${BASE_URL}/${id}/role`, req);
|
||||
}
|
||||
|
Reference in New Issue
Block a user