From 756fc1038c0a6adba8bc3c71c425696ffb140836 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Sat, 29 Apr 2023 14:18:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9ESQL=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=80=A0=E6=95=B0=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=96=B9?= =?UTF-8?q?=E4=BE=BF=E4=B8=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A1=AB=E5=85=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/codegen/index.ts | 25 +++ src/views/infra/codegen/FakeData.vue | 152 ++++++++++++++++++ .../components/FakeDataColumInfoForm.vue | 96 +++++++++++ src/views/infra/codegen/components/index.ts | 3 +- src/views/infra/codegen/index.vue | 17 ++ 5 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 src/views/infra/codegen/FakeData.vue create mode 100644 src/views/infra/codegen/components/FakeDataColumInfoForm.vue diff --git a/src/api/infra/codegen/index.ts b/src/api/infra/codegen/index.ts index 64701efe4..b241d4c5f 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 000000000..27ac8ed1c --- /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 000000000..979dbea5f --- /dev/null +++ b/src/views/infra/codegen/components/FakeDataColumInfoForm.vue @@ -0,0 +1,96 @@ + + diff --git a/src/views/infra/codegen/components/index.ts b/src/views/infra/codegen/components/index.ts index 1634a76f0..27bf93bb8 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 6a554d5d9..4d078ecad 100644 --- a/src/views/infra/codegen/index.vue +++ b/src/views/infra/codegen/index.vue @@ -100,6 +100,14 @@ > 预览 + + 造数 + + + -- Gitee From 16848e4a895a520814891fb302c7468d6de55e5e Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Tue, 9 May 2023 16:25:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/codegen/FakeData.vue | 35 ---------------------------- 1 file changed, 35 deletions(-) diff --git a/src/views/infra/codegen/FakeData.vue b/src/views/infra/codegen/FakeData.vue index dd0e4f42f..940ecad9d 100644 --- a/src/views/infra/codegen/FakeData.vue +++ b/src/views/infra/codegen/FakeData.vue @@ -1,40 +1,5 @@