refactor(api): code style

pull/1/MERGE
xingyu 2023-03-22 23:23:12 +08:00
parent 0216cce5c2
commit 3d588baac4
15 changed files with 75 additions and 81 deletions

View File

@ -40,11 +40,11 @@ export interface ApiAccessLogExportReqVO {
}
// 查询列表API 访问日志
export function getApiAccessLogPageApi(params: ApiAccessLogPageReqVO) {
export function getApiAccessLogPage(params: ApiAccessLogPageReqVO) {
return defHttp.get({ url: '/infra/api-access-log/page', params })
}
// 导出API 访问日志
export function exportApiAccessLogApi(params: ApiAccessLogExportReqVO) {
export function exportApiAccessLog(params: ApiAccessLogExportReqVO) {
return defHttp.download({ url: '/infra/api-access-log/export-excel', params }, '访问日志.xls')
}

View File

@ -46,19 +46,19 @@ export interface ApiErrorLogExportReqVO {
}
// 查询列表API 访问日志
export function getApiErrorLogPageApi(params: ApiErrorLogPageReqVO) {
export function getApiErrorLogPage(params: ApiErrorLogPageReqVO) {
return defHttp.get({ url: '/infra/api-error-log/page', params })
}
// 更新 API 错误日志的处理状态
export function updateApiErrorLogPageApi(id: number, processStatus: number) {
export function updateApiErrorLogPage(id: number, processStatus: number) {
return defHttp.put({
url: '/infra/api-error-log/update-status?id=' + id + '&processStatus=' + processStatus
})
}
// 导出API 错误日志
export function exportApiErrorLogApi(params: ApiErrorLogExportReqVO) {
export function exportApiErrorLog(params: ApiErrorLogExportReqVO) {
return defHttp.download(
{
url: '/infra/api-error-log/export-excel',

View File

@ -2,56 +2,56 @@ import { defHttp } from '@/utils/http/axios'
import type { CodegenUpdateReqVO, CodegenCreateListReqVO } from './types'
// 查询列表代码生成表定义
export function getCodegenTablePageApi(params) {
export function getCodegenTablePage(params) {
return defHttp.get({ url: '/infra/codegen/table/page', params })
}
// 查询详情代码生成表定义
export function getCodegenTableApi(id: number) {
export function getCodegenTable(id: number) {
return defHttp.get({ url: '/infra/codegen/detail?tableId=' + id })
}
// 新增代码生成表定义
export function createCodegenTableApi(data: CodegenCreateListReqVO) {
export function createCodegenTable(data: CodegenCreateListReqVO) {
return defHttp.post({ url: '/infra/codegen/create', data })
}
// 修改代码生成表定义
export function updateCodegenTableApi(data: CodegenUpdateReqVO) {
export function updateCodegenTable(data: CodegenUpdateReqVO) {
return defHttp.put({ url: '/infra/codegen/update', data })
}
// 基于数据库的表结构,同步数据库的表和字段定义
export function syncCodegenFromDBApi(id: number) {
export function syncCodegenFromDB(id: number) {
return defHttp.put({ url: '/infra/codegen/sync-from-db?tableId=' + id })
}
// 基于 SQL 建表语句,同步数据库的表和字段定义
export function syncCodegenFromSQLApi(id: number, sql: string) {
export function syncCodegenFromSQL(id: number, sql: string) {
return defHttp.put({ url: '/infra/codegen/sync-from-sql?tableId=' + id + '&sql=' + sql })
}
// 预览生成代码
export function previewCodegenApi(id: number) {
export function previewCodegen(id: number) {
return defHttp.get({ url: '/infra/codegen/preview?tableId=' + id })
}
// 下载生成代码
export function downloadCodegenApi(id: number) {
export function downloadCodegen(id: number) {
return defHttp.download({ url: '/infra/codegen/download?tableId=' + id }, '生成代码.zip')
}
// 获得表定义
export function getSchemaTableListApi(params) {
export function getSchemaTableList(params) {
return defHttp.get({ url: '/infra/codegen/db/table/list', params })
}
// 基于数据库的表结构,创建代码生成器的表定义
export function createCodegenListApi(data) {
export function createCodegenList(data) {
return defHttp.post({ url: '/infra/codegen/create-list', data })
}
// 删除代码生成表定义
export function deleteCodegenTableApi(id: number) {
export function deleteCodegenTable(id: number) {
return defHttp.delete({ url: '/infra/codegen/delete?tableId=' + id })
}

View File

@ -27,36 +27,36 @@ export interface ConfigExportReqVO {
}
// 查询参数列表
export function getConfigPageApi(params: ConfigPageReqVO) {
export function getConfigPage(params: ConfigPageReqVO) {
return defHttp.get({ url: '/infra/config/page', params })
}
// 查询参数详情
export function getConfigApi(id: number) {
export function getConfig(id: number) {
return defHttp.get({ url: '/infra/config/get?id=' + id })
}
// 根据参数键名查询参数值
export function getConfigKeyApi(configKey: string) {
export function getConfigKey(configKey: string) {
return defHttp.get({ url: '/infra/config/get-value-by-key?key=' + configKey })
}
// 新增参数
export function createConfigApi(data: ConfigVO) {
export function createConfig(data: ConfigVO) {
return defHttp.post({ url: '/infra/config/create', data })
}
// 修改参数
export function updateConfigApi(data: ConfigVO) {
export function updateConfig(data: ConfigVO) {
return defHttp.put({ url: '/infra/config/update', data })
}
// 删除参数
export function deleteConfigApi(id: number) {
export function deleteConfig(id: number) {
return defHttp.delete({ url: '/infra/config/delete?id=' + id })
}
// 导出参数
export function exportConfigApi(params: ConfigExportReqVO) {
export function exportConfig(params: ConfigExportReqVO) {
return defHttp.download({ url: '/infra/config/export', params }, '参数.xls')
}

View File

@ -10,26 +10,26 @@ export interface DataSourceConfigVO {
}
// 查询数据源配置列表
export function getDataSourceConfigListApi() {
export function getDataSourceConfigList() {
return defHttp.get({ url: '/infra/data-source-config/list' })
}
// 查询数据源配置详情
export function getDataSourceConfigApi(id: number) {
export function getDataSourceConfig(id: number) {
return defHttp.get({ url: '/infra/data-source-config/get?id=' + id })
}
// 新增数据源配置
export function createDataSourceConfigApi(data: DataSourceConfigVO) {
export function createDataSourceConfig(data: DataSourceConfigVO) {
return defHttp.post({ url: '/infra/data-source-config/create', data })
}
// 修改数据源配置
export function updateDataSourceConfigApi(data: DataSourceConfigVO) {
export function updateDataSourceConfig(data: DataSourceConfigVO) {
return defHttp.put({ url: '/infra/data-source-config/update', data })
}
// 删除数据源配置
export function deleteDataSourceConfigApi(id: number) {
export function deleteDataSourceConfig(id: number) {
return defHttp.delete({ url: '/infra/data-source-config/delete?id=' + id })
}

View File

@ -1,16 +1,16 @@
import { defHttp } from '@/utils/http/axios'
// 导出Html
export function exportHtmlApiasync() {
export function exportHtml() {
return defHttp.get({ url: '/infra/db-doc/export-html', responseType: 'blob' })
}
// 导出Word
export function exportWordApi() {
export function exportWord() {
return defHttp.get({ url: '/infra/db-doc/export-word', responseType: 'blob' })
}
// 导出Markdown
export function exportMarkdownApi() {
export function exportMarkdown() {
return defHttp.get({ url: '/infra/db-doc/export-markdown', responseType: 'blob' })
}

View File

@ -18,11 +18,11 @@ export interface FilePageReqVO extends PageParam {
}
// 查询文件列表
export function getFilePageApi(params: FilePageReqVO) {
export function getFilePage(params: FilePageReqVO) {
return defHttp.get({ url: '/infra/file/page', params })
}
// 删除文件
export function deleteFileApi(id: number) {
export function deleteFile(id: number) {
return defHttp.delete({ url: '/infra/file/delete?id=' + id })
}

View File

@ -31,36 +31,36 @@ export interface FileConfigPageReqVO extends PageParam {
}
// 查询文件配置列表
export function getFileConfigPageApi(params: FileConfigPageReqVO) {
export function getFileConfigPage(params: FileConfigPageReqVO) {
return defHttp.get({ url: '/infra/file-config/page', params })
}
// 查询文件配置详情
export function getFileConfigApi(id: number) {
export function getFileConfig(id: number) {
return defHttp.get({ url: '/infra/file-config/get?id=' + id })
}
// 更新文件配置为主配置
export function updateFileConfigMasterApi(id: number) {
export function updateFileConfigMaster(id: number) {
return defHttp.put({ url: '/infra/file-config/update-master?id=' + id })
}
// 新增文件配置
export function createFileConfigApi(data: FileConfigVO) {
export function createFileConfig(data: FileConfigVO) {
return defHttp.post({ url: '/infra/file-config/create', data })
}
// 修改文件配置
export function updateFileConfigApi(data: FileConfigVO) {
export function updateFileConfig(data: FileConfigVO) {
return defHttp.put({ url: '/infra/file-config/update', data })
}
// 删除文件配置
export function deleteFileConfigApi(id: number) {
export function deleteFileConfig(id: number) {
return defHttp.delete({ url: '/infra/file-config/delete?id=' + id })
}
// 测试文件配置
export function testFileConfigApi(id: number) {
export function testFileConfig(id: number) {
return defHttp.get({ url: '/infra/file-config/test?id=' + id })
}

View File

@ -26,37 +26,37 @@ export interface JobExportReqVO {
}
// 任务列表
export function getJobPageApi(params: JobPageReqVO) {
export function getJobPage(params: JobPageReqVO) {
return defHttp.get({ url: '/infra/job/page', params })
}
// 任务详情
export function getJobApi(id: number) {
export function getJob(id: number) {
return defHttp.get({ url: '/infra/job/get?id=' + id })
}
// 新增任务
export function createJobApi(data: JobVO) {
export function createJob(data: JobVO) {
return defHttp.post({ url: '/infra/job/create', data })
}
// 修改定时任务调度
export function updateJobApi(data: JobVO) {
export function updateJob(data: JobVO) {
return defHttp.put({ url: '/infra/job/update', data })
}
// 删除定时任务调度
export function deleteJobApi(id: number) {
export function deleteJob(id: number) {
return defHttp.delete({ url: '/infra/job/delete?id=' + id })
}
// 导出定时任务调度
export function exportJobApi(params: JobExportReqVO) {
export function exportJob(params: JobExportReqVO) {
return defHttp.download({ url: '/infra/job/export-excel', params }, '定时任务.xls')
}
// 任务状态修改
export function updateJobStatusApi(id: number, status: number) {
export function updateJobStatus(id: number, status: number) {
const params = {
id,
status
@ -65,11 +65,11 @@ export function updateJobStatusApi(id: number, status: number) {
}
// 定时任务立即执行一次
export function runJobApi(id: number) {
export function runJob(id: number) {
return defHttp.put({ url: '/infra/job/trigger?id=' + id })
}
// 获得定时任务的下 n 次执行时间
export function getJobNextTimesApi(id: number) {
export function getJobNextTimes(id: number) {
return defHttp.get({ url: '/infra/job/get_next_times?id=' + id })
}

View File

@ -31,22 +31,16 @@ export interface JobLogExportReqVO {
}
// 任务日志列表
export function getJobLogPageApi(params: JobLogPageReqVO) {
export function getJobLogPage(params: JobLogPageReqVO) {
return defHttp.get({ url: '/infra/job-log/page', params })
}
// 任务日志详情
export function getJobLogApi(id: number) {
export function getJobLog(id: number) {
return defHttp.get({ url: '/infra/job-log/get?id=' + id })
}
// 导出定时任务日志
export function exportJobLogApi(params: JobLogExportReqVO) {
return defHttp.download(
{
url: '/infra/job-log/export-excel',
params
},
'定时任务日志.xls'
)
export function exportJobLog(params: JobLogExportReqVO) {
return defHttp.download({ url: '/infra/job-log/export-excel', params }, '定时任务日志.xls')
}

View File

@ -3,17 +3,17 @@ import { defHttp } from '@/utils/http/axios'
/**
* redis
*/
export function getCacheApi() {
export function getCache() {
return defHttp.get({ url: '/infra/redis/get-monitor-info' })
}
// 获取模块
export function getKeyDefineListApi() {
export function getKeyDefineList() {
return defHttp.get({ url: '/infra/redis/get-key-define-list' })
}
/**
* redis key
*/
export function getKeyListApi(keyTemplate: string) {
export function getKeyList(keyTemplate: string) {
return defHttp.get({
url: '/infra/redis/get-key-list',
params: {
@ -22,16 +22,16 @@ export function getKeyListApi(keyTemplate: string) {
})
}
// 获取缓存内容
export function getKeyValueApi(key: string) {
export function getKeyValue(key: string) {
return defHttp.get({ url: '/infra/redis/get-key-value?key=' + key })
}
// 根据键名删除缓存
export function deleteKeyApi(key: string) {
export function deleteKey(key: string) {
return defHttp.delete({ url: '/infra/redis/delete-key?key=' + key })
}
export function deleteKeysApi(keyTemplate: string) {
export function deleteKeys(keyTemplate: string) {
return defHttp.delete({
url: '/infra/redis/delete-keys?',
params: {

View File

@ -21,7 +21,7 @@ const { t } = useI18n()
const src = ref('')
/** 页面加载 */
const init = async () => {
const res = await DbDocApi.exportHtmlApi()
const res = await DbDocApi.exportHtml()
let blob = new Blob([res], { type: 'text/html' })
let blobUrl = window.URL.createObjectURL(blob)
src.value = blobUrl
@ -29,15 +29,15 @@ const init = async () => {
/** 处理导出 */
const handleExport = async (type: string) => {
if (type === 'HTML') {
const res = await DbDocApi.exportHtmlApi()
const res = await DbDocApi.exportHtml()
downloadByData(res, '数据库文档.html')
}
if (type === 'Word') {
const res = await DbDocApi.exportWordApi()
const res = await DbDocApi.exportWord()
downloadByData(res, '数据库文档.doc')
}
if (type === 'Markdown') {
const res = await DbDocApi.exportMarkdownApi()
const res = await DbDocApi.exportMarkdown()
downloadByData(res, '数据库文档.md')
}
}

View File

@ -30,7 +30,7 @@ import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { IconEnum } from '@/enums/appEnum'
import { BasicTable, useTable, TableAction } from '@/components/Table'
import { deleteFileApi, getFilePageApi } from '@/api/infra/file'
import { deleteFile, getFilePage } from '@/api/infra/file'
import { columns, searchFormSchema } from './file.data'
const { t } = useI18n()
@ -38,7 +38,7 @@ const { createMessage } = useMessage()
const [registerTable, { reload }] = useTable({
title: '文件列表',
api: getFilePageApi,
api: getFilePage,
columns,
formConfig: {
labelWidth: 120,
@ -60,7 +60,7 @@ function handleAdd() {
}
async function handleDelete(record: Recordable) {
await deleteFileApi(record.id)
await deleteFile(record.id)
createMessage.success(t('common.delSuccessText'))
reload()
}

View File

@ -8,7 +8,7 @@ import { ref, computed, unref } from 'vue'
import { BasicModal, useModalInner } from '@/components/Modal'
import { BasicForm, useForm } from '@/components/Form'
import { formSchema } from './ficleConfig.data'
import { createFileConfigApi, getFileConfigApi, updateFileConfigApi } from '@/api/infra/fileConfig'
import { createFileConfig, getFileConfig, updateFileConfig } from '@/api/infra/fileConfig'
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
@ -28,7 +28,7 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
const res = await getFileConfigApi(data.record.id)
const res = await getFileConfig(data.record.id)
rowId.value = res.id
setFieldsValue({ ...res })
}
@ -41,9 +41,9 @@ async function handleSubmit() {
const values = await validate()
setModalProps({ confirmLoading: true })
if (unref(isUpdate)) {
await updateFileConfigApi(values)
await updateFileConfig(values)
} else {
await createFileConfigApi(values)
await createFileConfig(values)
}
closeModal()
emit('success')

View File

@ -36,7 +36,7 @@ import { useModal } from '@/components/Modal'
import PostModal from './FileConfigModal.vue'
import { IconEnum } from '@/enums/appEnum'
import { BasicTable, useTable, TableAction } from '@/components/Table'
import { deleteFileConfigApi, getFileConfigPageApi, testFileConfigApi, updateFileConfigMasterApi } from '@/api/infra/fileConfig'
import { deleteFileConfig, getFileConfigPage, testFileConfig, updateFileConfigMaster } from '@/api/infra/fileConfig'
import { columns, searchFormSchema } from './ficleConfig.data'
const { t } = useI18n()
@ -45,7 +45,7 @@ const [registerModal, { openModal }] = useModal()
const [registerTable, { reload }] = useTable({
title: '文件配置列表',
api: getFileConfigPageApi,
api: getFileConfigPage,
columns,
formConfig: {
labelWidth: 120,
@ -76,7 +76,7 @@ function handleEdit(record: Recordable) {
}
async function handleTest(record: Recordable) {
const res = await testFileConfigApi(record.id)
const res = await testFileConfig(record.id)
createSuccessModal({ content: res })
}
@ -86,14 +86,14 @@ function handleMaster(record: Recordable) {
iconType: 'warning',
content: '是否确认修改配置编号为"' + record.id + '"的数据项为主配置?',
async onOk() {
await updateFileConfigMasterApi(record.id)
await updateFileConfigMaster(record.id)
createMessage.success('配置成功')
}
})
}
async function handleDelete(record: Recordable) {
await deleteFileConfigApi(record.id)
await deleteFileConfig(record.id)
createMessage.success(t('common.delSuccessText'))
reload()
}