diff --git a/src/api/infra/codegen/index.ts b/src/api/infra/codegen/index.ts index feff57a2a16235b363e7a72eda757d531d191d0d..e648190b5a0696754ef50ee115631b1e840ec061 100644 --- a/src/api/infra/codegen/index.ts +++ b/src/api/infra/codegen/index.ts @@ -57,6 +57,16 @@ export type CodegenPreviewVO = { code: string } +export type CodegenFakeDataVO = { + tableId: string + num: string +} + +export type CodegenMockTypeRespVO = { + type: number + lable: string +} + export type CodegenUpdateReqVO = { table: CodegenTableVO | any columns: CodegenColumnVO[] @@ -102,6 +112,21 @@ export const previewCodegen = (id: number) => { return request.get({ url: '/infra/codegen/preview?tableId=' + id }) } +// SQL造数生成代码 +export const fakeDataCodegen = (params) => { + return request.get({ url: '/infra/codegen/fake-data', params }) +} + +// 获取SQL字段模拟类型列表 +export const fakeDataMockTypeList = () => { + return request.get({ url: '/infra/codegen/fake-data/types' }) +} + +//通过模拟类型获取响应的列表参数 +export const getMockParamsByMockType = (type: number) => { + return request.get({ url: '/infra/codegen/fake-data/params?mockType=' + type }) +} + // 下载生成代码 export const downloadCodegen = (id: number) => { return request.download({ url: '/infra/codegen/download?tableId=' + id }) diff --git a/src/views/infra/codegen/FakeData.vue b/src/views/infra/codegen/FakeData.vue new file mode 100644 index 0000000000000000000000000000000000000000..940ecad9d366f000d99da7d4c8844d917556eeb5 --- /dev/null +++ b/src/views/infra/codegen/FakeData.vue @@ -0,0 +1,152 @@ + + + diff --git a/src/views/infra/codegen/components/FakeDataColumInfoForm.vue b/src/views/infra/codegen/components/FakeDataColumInfoForm.vue new file mode 100644 index 0000000000000000000000000000000000000000..496fe568361249cab2420f0f1d741416842734a0 --- /dev/null +++ b/src/views/infra/codegen/components/FakeDataColumInfoForm.vue @@ -0,0 +1,112 @@ + + diff --git a/src/views/infra/codegen/components/index.ts b/src/views/infra/codegen/components/index.ts index 1634a76f0cfd4efa287a081889ea2edea628d8be..27bf93bb892ad90c070338965babcfb54a0e914c 100644 --- a/src/views/infra/codegen/components/index.ts +++ b/src/views/infra/codegen/components/index.ts @@ -1,4 +1,5 @@ import BasicInfoForm from './BasicInfoForm.vue' import ColumInfoForm from './ColumInfoForm.vue' import GenerateInfoForm from './GenerateInfoForm.vue' -export { BasicInfoForm, ColumInfoForm, GenerateInfoForm } +import FakeDataColumInfoForm from './FakeDataColumInfoForm.vue' +export { BasicInfoForm, ColumInfoForm, GenerateInfoForm, FakeDataColumInfoForm } diff --git a/src/views/infra/codegen/index.vue b/src/views/infra/codegen/index.vue index 69c3d1254e8c6168b35cf49360b39950e0014a35..b0375c447784902cdc3b29d5550984dd87a36609 100644 --- a/src/views/infra/codegen/index.vue +++ b/src/views/infra/codegen/index.vue @@ -102,6 +102,14 @@ > 预览 + + 造数 + + +