fix(generated): Update the error message in the generated client code

This commit is contained in:
sol 2026-03-12 06:19:50 +08:00
parent dbfdcf1e10
commit acc5c83f88
13 changed files with 681 additions and 69 deletions

View file

@ -26,7 +26,7 @@ export class PoiService {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}

View file

@ -43,7 +43,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -65,7 +65,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -87,7 +87,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -109,7 +109,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -131,7 +131,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -153,7 +153,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -175,7 +175,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -197,7 +197,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -219,7 +219,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -242,7 +242,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -270,7 +270,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -293,7 +293,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -316,7 +316,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -339,7 +339,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -362,7 +362,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -385,7 +385,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -408,7 +408,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -431,7 +431,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -454,7 +454,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -477,7 +477,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -500,7 +500,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}

View file

@ -19,6 +19,7 @@ export { BaseVoListVerificationResult } from './models/BaseVoListVerificationRes
export { BaseVoMenuEntity } from './models/BaseVoMenuEntity';
export { BaseVoMessageEnvelopeEntityObject } from './models/BaseVoMessageEnvelopeEntityObject';
export { BaseVoPageVoMessageEnvelopeEntityObject } from './models/BaseVoPageVoMessageEnvelopeEntityObject';
export { BaseVoPageVoRequestLogEntity } from './models/BaseVoPageVoRequestLogEntity';
export { BaseVoPageVoUserEntity } from './models/BaseVoPageVoUserEntity';
export { BaseVoPermissionEntity } from './models/BaseVoPermissionEntity';
export { BaseVoRoleEntity } from './models/BaseVoRoleEntity';
@ -37,8 +38,11 @@ export { MessageEnvelopeEntityObject } from './models/MessageEnvelopeEntityObjec
export { MessageEnvelopePageDto } from './models/MessageEnvelopePageDto';
export { MessageEnvelopeUpdateDto } from './models/MessageEnvelopeUpdateDto';
export type { PageVoMessageEnvelopeEntityObject } from './models/PageVoMessageEnvelopeEntityObject';
export type { PageVoRequestLogEntity } from './models/PageVoRequestLogEntity';
export type { PageVoUserEntity } from './models/PageVoUserEntity';
export type { PermissionEntity } from './models/PermissionEntity';
export type { RequestLogEntity } from './models/RequestLogEntity';
export type { RequestLogPageDto } from './models/RequestLogPageDto';
export type { RoleCreateDto } from './models/RoleCreateDto';
export type { RoleEntity } from './models/RoleEntity';
export type { RoleUpdateDto } from './models/RoleUpdateDto';

View file

@ -0,0 +1,39 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { PageVoRequestLogEntity } from './PageVoRequestLogEntity';
/**
*
*/
export type BaseVoPageVoRequestLogEntity = {
/**
*
*/
code?: number;
/**
*
*/
message?: string;
data?: PageVoRequestLogEntity;
/**
*
*/
time?: string;
/**
*
*/
type?: BaseVoPageVoRequestLogEntity.type;
};
export namespace BaseVoPageVoRequestLogEntity {
/**
*
*/
export enum type {
SUCCESS = 'SUCCESS',
WARNING = 'WARNING',
INFO = 'INFO',
ERROR = 'ERROR',
}
}

View file

@ -0,0 +1,27 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { RequestLogEntity } from './RequestLogEntity';
/**
*
*/
export type PageVoRequestLogEntity = {
/**
*
*/
total?: number;
/**
*
*/
page?: number;
/**
*
*/
size?: number;
/**
*
*/
result?: Array<RequestLogEntity>;
};

View file

@ -0,0 +1,98 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { UserEntity } from './UserEntity';
/**
*
*/
export type RequestLogEntity = {
id?: string;
/**
*
*/
type?: string;
/**
*
*/
sort?: number;
/**
*
*/
createTime?: string;
/**
*
*/
updateTime?: string;
/**
*
*/
description?: string;
/**
* id
*/
parentId?: string;
parent?: RequestLogEntity;
/**
*
*/
children?: Array<RequestLogEntity>;
/**
* ID
*/
traceId?: string;
/**
*
*/
serviceName?: string;
/**
*
*/
nodeName?: string;
/**
* IP
*/
nodeIp?: string;
/**
* HTTP方法
*/
method?: string;
/**
* URI
*/
uri?: string;
/**
*
*/
queryString?: string;
/**
* HTTP状态码
*/
status?: number;
/**
* 线ID
*/
threadId?: number;
/**
*
*/
errorLog?: string;
/**
*
*/
isPrimaryErr?: boolean;
/**
*
*/
businessMethod?: string;
/**
* /Controller
*/
businessController?: string;
/**
* ID
*/
userId?: string;
userEntity?: UserEntity;
};

View file

@ -0,0 +1,62 @@
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
/**
*
*/
export type RequestLogPageDto = {
/**
*
*/
page: number;
/**
*
*/
size: number;
/**
* ID
*/
traceId?: string;
/**
*
*/
serviceName?: string;
/**
*
*/
nodeName?: string;
/**
* IP
*/
nodeIp?: string;
/**
* HTTP方法
*/
method?: string;
/**
* URI
*/
uri?: string;
/**
*
*/
queryString?: string;
/**
*
*/
isPrimaryErr?: boolean;
/**
*
*/
businessMethod?: string;
/**
* /Controller
*/
businessController?: string;
/**
* ID
*/
userId?: string;
};

View file

@ -13,6 +13,7 @@ import type { BaseVoListUserEntity } from '../models/BaseVoListUserEntity';
import type { BaseVoMenuEntity } from '../models/BaseVoMenuEntity';
import type { BaseVoMessageEnvelopeEntityObject } from '../models/BaseVoMessageEnvelopeEntityObject';
import type { BaseVoPageVoMessageEnvelopeEntityObject } from '../models/BaseVoPageVoMessageEnvelopeEntityObject';
import type { BaseVoPageVoRequestLogEntity } from '../models/BaseVoPageVoRequestLogEntity';
import type { BaseVoPageVoUserEntity } from '../models/BaseVoPageVoUserEntity';
import type { BaseVoPermissionEntity } from '../models/BaseVoPermissionEntity';
import type { BaseVoRoleEntity } from '../models/BaseVoRoleEntity';
@ -27,6 +28,7 @@ import type { MessageEnvelopeCreateDto } from '../models/MessageEnvelopeCreateDt
import type { MessageEnvelopePageDto } from '../models/MessageEnvelopePageDto';
import type { MessageEnvelopeUpdateDto } from '../models/MessageEnvelopeUpdateDto';
import type { PermissionEntity } from '../models/PermissionEntity';
import type { RequestLogPageDto } from '../models/RequestLogPageDto';
import type { RoleCreateDto } from '../models/RoleCreateDto';
import type { RoleUpdateDto } from '../models/RoleUpdateDto';
import type { UserCreateDto } from '../models/UserCreateDto';
@ -57,7 +59,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -79,7 +81,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -101,7 +103,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -123,7 +125,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -140,7 +142,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -162,7 +164,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -184,7 +186,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -206,7 +208,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -228,7 +230,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -245,7 +247,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -267,7 +269,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -289,7 +291,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -311,7 +313,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -328,7 +330,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -350,7 +352,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -374,7 +376,29 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
/**
*
* @param requestBody
* @returns BaseVoPageVoRequestLogEntity OK
* @throws ApiError
*/
public static findPageRequestLog(
requestBody: RequestLogPageDto,
): CancelablePromise<BaseVoPageVoRequestLogEntity> {
return __request(OpenAPI, {
method: 'POST',
url: '/request-log/page',
body: requestBody,
mediaType: 'application/json',
errors: {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `业务异常`,
},
});
}
@ -396,7 +420,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -418,7 +442,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -440,7 +464,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -463,7 +487,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -480,7 +504,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -503,7 +527,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -520,7 +544,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -543,7 +567,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -560,7 +584,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -583,7 +607,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -600,7 +624,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -623,7 +647,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -640,7 +664,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -663,7 +687,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -680,7 +704,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -703,7 +727,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -720,7 +744,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -743,7 +767,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -766,7 +790,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -783,7 +807,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -806,7 +830,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -829,7 +853,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -846,7 +870,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -869,7 +893,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -892,7 +916,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -915,7 +939,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -938,7 +962,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}
@ -961,7 +985,7 @@ export class Service {
400: `参数校验异常`,
401: `未登录异常`,
403: `无权限异常`,
500: `系统异常`,
500: `业务异常`,
},
});
}

View file

@ -0,0 +1,219 @@
<script lang='ts' setup>
import {onMounted, ref} from "vue";
import {PageVoRequestLogEntity, RequestLogEntity, RequestLogPageDto, Service} from "~/generated/system";
import {ElTable as ElTableRefType} from "element-plus/es/components/table";
import {
dayjs,
ElButton,
ElForm,
ElFormItem,
ElInput,
ElOption,
ElPagination,
ElSelect,
ElTable,
ElTableColumn,
ElTag
} from "element-plus";
import {usePage} from "~/composables/PageHook";
const tableData = ref<PageVoRequestLogEntity>({
total: 0,
result: [] as RequestLogEntity[]
});
const tableLoading = ref(true);
const getTable = async () => {
tableLoading.value = true;
return Service.findPageRequestLog(requestData.value).then((res) => {
tableData.value = res.data as PageVoRequestLogEntity
}).finally(() => {
tableLoading.value = false;
});
};
onMounted(() => {
getTable();
});
const defaultRequestData: () => RequestLogPageDto = () => ({
page: 1,
size: 20,
traceId: '',
serviceName: '',
nodeName: '',
nodeIp: '',
method: '',
uri: '',
businessController: '',
isPrimaryErr: undefined,
});
const requestData = ref<RequestLogPageDto>(defaultRequestData());
const {
handleCurrentChange, handleSizeChange,
resetPageData, search
} = usePage(requestData, getTable);
const tableRef = ref<InstanceType<typeof ElTableRefType>>();
/**
* 请求方式颜色
*/
const getMethodTagType = (method?: string) => {
switch (method) {
case "GET":
return "success";
case "POST":
return "primary";
case "PUT":
return "warning";
case "DELETE":
return "danger";
default:
return "info";
}
};
/**
* 状态码颜色
*/
const getStatusTagType = (status?: number) => {
if (!status) return "info";
if (status >= 200 && status < 300)
return "success";
if (status >= 300 && status < 400)
return "warning";
if (status >= 400 && status < 500)
return "danger";
if (status >= 500)
return "danger";
return "info";
};
</script>
<template>
<div class='main'>
<div class='filter-header'>
<el-form inline>
<el-form-item label='链路 ID' class="w-250px">
<el-input v-model='requestData.traceId' class="important-w-full" clearable placeholder='请输入链路 ID'
@change="search">
</el-input>
</el-form-item>
<el-form-item label='服务名' class="w-250px">
<el-input v-model='requestData.serviceName' class="important-w-full" clearable placeholder='请输入服务名'
@change="search">
</el-input>
</el-form-item>
<el-form-item label='节点名' class="w-250px">
<el-input v-model='requestData.nodeName' class="important-w-full" clearable placeholder='请输入节点名'
@change="search">
</el-input>
</el-form-item>
<el-form-item label='节点 IP' class="w-250px">
<el-input v-model='requestData.nodeIp' class="important-w-full" clearable placeholder='请输入节点 IP'
@change="search">
</el-input>
</el-form-item>
<el-form-item label='请求方式' class="w-250px">
<el-select v-model='requestData.method' class="important-w-full" clearable placeholder='请选择'
@change="search">
<el-option value='GET' label='GET'></el-option>
<el-option value='POST' label='POST'></el-option>
<el-option value='PUT' label='PUT'></el-option>
<el-option value='DELETE' label='DELETE'></el-option>
</el-select>
</el-form-item>
<el-form-item label='请求 URI' class="w-250px">
<el-input v-model='requestData.uri' class="important-w-full" clearable placeholder='请输入 URI'
@change="search">
</el-input>
</el-form-item>
<el-form-item label='业务模块' class="w-250px">
<el-input v-model='requestData.businessController' class="important-w-full" clearable placeholder='请输入业务模块'
@change="search">
</el-input>
</el-form-item>
<el-form-item label='重要异常' class="w-250px">
<el-select v-model='requestData.isPrimaryErr' class="important-w-full" clearable placeholder='请选择'
@change="search">
<el-option :value='false' label='否'></el-option>
<el-option :value='true' label='是'></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type='primary' @click='search'>查询</el-button>
<el-button @click='resetPageData(defaultRequestData())'>重置</el-button>
</el-form-item>
</el-form>
</div>
<div class='table'>
<div class='table-container'>
<el-table ref='tableRef' v-loading='tableLoading' :data='tableData.result' border
height='100%' row-key='id' stripe>
<el-table-column align='center' label='服务名' min-width='180' prop='serviceName'>
</el-table-column>
<el-table-column align='center' label='节点名' min-width='150' prop='nodeName'>
</el-table-column>
<el-table-column align='center' label='节点 IP' min-width='140' prop='nodeIp'>
</el-table-column>
<el-table-column align='center' label='请求方式' min-width='100' prop='method'>
<template #default='{ row }'>
<el-tag :type="getMethodTagType(row.method)">
{{ row.method }}
</el-tag>
</template>
</el-table-column>
<el-table-column align='center' label='请求 URI' min-width='220' prop='uri'>
</el-table-column>
<el-table-column align='center' label='状态码' min-width='90' prop='status'>
<template #default='{ row }'>
<el-tag :type="getStatusTagType(row.status)">
{{ row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column align='center' label='链路 ID' min-width='220' prop='traceId'>
</el-table-column>
<el-table-column align='center' label='业务模块' min-width='180' prop='businessController'>
</el-table-column>
<el-table-column align='center' label='业务方法' min-width='180' prop='businessMethod'>
</el-table-column>
<el-table-column align='center' label='线程 ID' min-width='120' prop='threadId'>
</el-table-column>
<el-table-column align='center' label='创建时间' min-width='180' prop='createTime'>
<template #default='{ row }'>
{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}
</template>
</el-table-column>
<el-table-column align='center' label='是否是重要异常' min-width='120' prop='isPrimaryErr'>
<template #default='{ row }'>
<el-tag :type="row.isPrimaryErr ? 'danger' : 'success'">
{{ row.isPrimaryErr ? '是' : '否' }}
</el-tag>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class='page-footer'>
<el-pagination :current-page='requestData.page' :page-size='requestData.size'
:page-sizes="[10, 20, 50, 100, 200]" :total='tableData.total'
background layout="prev, pager, next, jumper, total, sizes"
@current-change='handleCurrentChange' @size-change="handleSizeChange">
</el-pagination>
</div>
</div>
</template>

View file

@ -1,9 +1,9 @@
package com.bgasol.common.requestLog.service;
import com.bgasol.common.core.base.dto.BasePageDto;
import com.bgasol.common.core.base.service.BaseTreeService;
import com.bgasol.model.system.requestLog.entity.RequestLogEntity;
import com.bgasol.common.requestLog.mapper.RequestLogMapper;
import com.bgasol.model.system.requestLog.dto.RequestLogPageDto;
import com.bgasol.model.system.requestLog.entity.RequestLogEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -11,7 +11,7 @@ import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@Slf4j
public class RequestLogService extends BaseTreeService<RequestLogEntity, BasePageDto<RequestLogEntity>> {
public class RequestLogService extends BaseTreeService<RequestLogEntity, RequestLogPageDto> {
private final RequestLogMapper requestLogMapper;
@Override

View file

@ -0,0 +1,81 @@
package com.bgasol.model.system.requestLog.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bgasol.common.core.base.dto.BasePageDto;
import com.bgasol.model.system.requestLog.entity.RequestLogEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Transient;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.ObjectUtils;
@Setter
@Getter
@SuperBuilder
@NoArgsConstructor
@Schema(description = "查询参数")
public class RequestLogPageDto extends BasePageDto<RequestLogEntity> {
@Schema(description = "全局链路ID")
@TableField("trace_id")
private String traceId;
@Schema(description = "服务名")
private String serviceName;
@Schema(description = "节点名")
private String nodeName;
@Schema(description = "节点IP")
private String nodeIp;
@Schema(description = "HTTP方法")
@TableField("method")
private String method;
@Schema(description = "请求URI")
@TableField("uri")
private String uri;
@Schema(description = "请求参数")
@TableField("query_string")
private String queryString;
@Schema(description = "是否是重要异常")
@TableField("is_primary_err")
private Boolean isPrimaryErr;
@Schema(description = "业务方法")
@TableField("business_method")
private String businessMethod;
@Schema(description = "业务模块/Controller")
@TableField("business_controller")
private String businessController;
@Schema(description = "用户ID")
@TableField("user_id")
@Transient
private String userId;
@Override
public Wrapper<RequestLogEntity> getQueryWrapper() {
LambdaQueryWrapper<RequestLogEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ObjectUtils.isNotEmpty(traceId), RequestLogEntity::getTraceId, traceId);
queryWrapper.eq(ObjectUtils.isNotEmpty(serviceName), RequestLogEntity::getServiceName, serviceName);
queryWrapper.eq(ObjectUtils.isNotEmpty(nodeName), RequestLogEntity::getNodeName, nodeName);
queryWrapper.eq(ObjectUtils.isNotEmpty(nodeIp), RequestLogEntity::getNodeIp, nodeIp);
queryWrapper.eq(ObjectUtils.isNotEmpty(method), RequestLogEntity::getMethod, method);
queryWrapper.eq(ObjectUtils.isNotEmpty(uri), RequestLogEntity::getUri, uri);
queryWrapper.eq(ObjectUtils.isNotEmpty(queryString), RequestLogEntity::getQueryString, queryString);
queryWrapper.eq(ObjectUtils.isNotEmpty(isPrimaryErr), RequestLogEntity::getIsPrimaryErr, isPrimaryErr);
queryWrapper.eq(ObjectUtils.isNotEmpty(businessMethod), RequestLogEntity::getBusinessMethod, businessMethod);
queryWrapper.eq(ObjectUtils.isNotEmpty(businessController), RequestLogEntity::getBusinessController, businessController);
queryWrapper.eq(ObjectUtils.isNotEmpty(userId), RequestLogEntity::getUserId, userId);
queryWrapper.isNull(RequestLogEntity::getParentId);
return queryWrapper;
}
}

View file

@ -0,0 +1,48 @@
package com.bgasol.web.system.requestLog.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.bgasol.common.core.base.controller.BaseController;
import com.bgasol.common.core.base.dto.BaseCreateDto;
import com.bgasol.common.core.base.dto.BasePageDto;
import com.bgasol.common.core.base.dto.BaseUpdateDto;
import com.bgasol.common.core.base.vo.BaseVo;
import com.bgasol.common.core.base.vo.PageVo;
import com.bgasol.common.requestLog.service.RequestLogService;
import com.bgasol.model.system.requestLog.dto.RequestLogPageDto;
import com.bgasol.model.system.requestLog.entity.RequestLogEntity;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Tag(name = "请求日志管理")
@RequestMapping("/request-log")
@Validated
public class RequestLogController extends BaseController<
RequestLogEntity,
RequestLogPageDto,
BaseCreateDto<RequestLogEntity>,
BaseUpdateDto<RequestLogEntity>> {
private final RequestLogService requestLogService;
@Override
public RequestLogService commonBaseService() {
return requestLogService;
}
@Override
@PostMapping("/page")
@Operation(summary = "分页查询请求日志", operationId = "findPageRequestLog")
@SaCheckPermission(value = "requestLog:findByPage", orRole = "admin")
public BaseVo<PageVo<RequestLogEntity>> findByPage(@RequestBody @Valid RequestLogPageDto pageDto) {
return super.findByPage(pageDto);
}
}

View file

@ -96,6 +96,16 @@ public class SystemInitData implements ApplicationRunner {
.path("/" + SystemConfigValues.ADMIN_PAGE_NAME + "/" + SystemConfigValues.SERVICE_NAME + "/menu")
.routeName(SystemConfigValues.ADMIN_PAGE_NAME + "_" + SystemConfigValues.SERVICE_NAME + "_menu")
.menuGroup(SystemConfigValues.ADMIN_MENU_GROUP_ID)
.build(),
MenuEntity.builder()
.id("requestLog")
.parentId(systemServiceId)
.name("请求日志管理")
.menuType(MenuType.PAGE)
.icon("IconParkLog")
.path("/" + SystemConfigValues.ADMIN_PAGE_NAME + "/" + SystemConfigValues.SERVICE_NAME + "/requestLog")
.routeName(SystemConfigValues.ADMIN_PAGE_NAME + "_" + SystemConfigValues.SERVICE_NAME + "_request_log")
.menuGroup(SystemConfigValues.ADMIN_MENU_GROUP_ID)
.build()
))
.build();