Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
appbuild
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
appbuild
Commits
6c037f57
Commit
6c037f57
authored
Jun 17, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加apipost生成接口文档逻辑
parent
091c103a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
336 additions
and
4 deletions
+336
-4
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/service/impl/GentableServiceImpl.java
...ase/system/gentable/service/impl/GentableServiceImpl.java
+4
-4
appbuild-manager/src/main/resources/template/doc/apipost.md.ftl
...ld-manager/src/main/resources/template/doc/apipost.md.ftl
+331
-0
appbuild-manager/src/main/resources/template/vue/VueDrawerShow.vue.ftl
...ger/src/main/resources/template/vue/VueDrawerShow.vue.ftl
+1
-0
No files found.
appbuild-manager/src/main/java/com/mortals/xhx/base/system/gentable/service/impl/GentableServiceImpl.java
View file @
6c037f57
...
@@ -215,7 +215,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -215,7 +215,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
}
if
(
temp
.
equals
(
"menu.sql.ftl"
)
||
temp
.
equals
(
"db.sql.ftl"
)
||
temp
.
equals
(
"dm_db.sql.ftl"
)
||
temp
.
equals
(
"api.md.ftl"
)||
temp
.
equals
(
"apipost.md.ftl"
))
{
if
(
temp
.
equals
(
"menu.sql.ftl"
)
||
temp
.
equals
(
"db.sql.ftl"
)
||
temp
.
equals
(
"dm_db.sql.ftl"
)
||
temp
.
equals
(
"api.md.ftl"
)
||
temp
.
equals
(
"apipost.md.ftl"
))
{
try
{
try
{
List
<
GentableEntity
>
tableList
=
new
ArrayList
<>();
List
<
GentableEntity
>
tableList
=
new
ArrayList
<>();
tableList
.
add
(
gentableEntity
);
tableList
.
add
(
gentableEntity
);
...
@@ -276,7 +276,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -276,7 +276,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"apipost.md.ftl"
));
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"apipost.md.ftl"
));
zipTemplate
(
"apipost.ftl"
,
"doc/apipost.json"
,
data
,
zip
);
zipTemplate
(
"apipost.ftl"
,
String
.
format
(
"doc/%s.json"
,
gentableEntity
.
getName
())
,
data
,
zip
);
IOUtils
.
closeQuietly
(
zip
);
IOUtils
.
closeQuietly
(
zip
);
return
outputStream
.
toByteArray
();
return
outputStream
.
toByteArray
();
...
@@ -307,7 +307,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -307,7 +307,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
zipTemplate
(
"dm_db.sql.ftl"
,
"db/dm_db.sql"
,
data
,
zip
);
zipTemplate
(
"dm_db.sql.ftl"
,
"db/dm_db.sql"
,
data
,
zip
);
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
FreeMarkerUtils
.
initFreeMarker
(
genFreePath
(
"api.md.ftl"
));
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
zipTemplate
(
"api.md.ftl"
,
"doc/api.md"
,
data
,
zip
);
zipTemplate
(
"apipost.md.ftl"
,
"doc/apipost.json"
,
data
,
zip
);
zipTemplate
(
"apipost.md.ftl"
,
String
.
format
(
"doc/%s.json"
,
appEntity
.
getName
())
,
data
,
zip
);
IOUtils
.
closeQuietly
(
zip
);
IOUtils
.
closeQuietly
(
zip
);
return
outputStream
.
toByteArray
();
return
outputStream
.
toByteArray
();
}
}
...
@@ -476,6 +476,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -476,6 +476,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
String
temp2
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
String
temp2
=
StringUtils
.
substringBetween
(
column
.
getColumnComment
(),
"("
,
")"
);
GenUtils
.
checkDict
(
column
,
temp1
);
GenUtils
.
checkDict
(
column
,
temp1
);
GenUtils
.
checkDict
(
column
,
temp2
);
GenUtils
.
checkDict
(
column
,
temp2
);
column
.
setColumnComment
(
StrUtil
.
removeAllLineBreaks
(
column
.
getColumnComment
()));
return
column
;
return
column
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
...
@@ -616,7 +617,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
...
@@ -616,7 +617,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
}
/**
/**
* 生成文档
* 生成文档
*/
*/
...
...
appbuild-manager/src/main/resources/template/doc/apipost.md.ftl
View file @
6c037f57
...
@@ -1038,6 +1038,337 @@
...
@@ -1038,6 +1038,337 @@
]
]
}
}
,{
"target_type": "api",
"name": "查询参数列表",
"mark": "developing",
"sort": 5,
"method": "POST",
"mock": "{}",
"mock_url": "${appInfo.path}/param/list",
"request": {
"url": "{{baseUrl}}${appInfo.path}/office/param/list",
"description": "字典参数列表查询",
"event": {
"pre_script": "",
"test": ""
},
"body": {
"mode": "json",
"parameter": [],
"raw": "{\n\t\"page\": 2,\n\t\"size\": 32,\n\t\"firstOrganize\": \"firstOrganize\",\n\t\"secondOrganize\": \"secondOrganize\",\n\t\"paramKey\": \"key\"\n}",
"raw_para": [
{
"description": "当前页",
"field_type": "Integer",
"is_checked": 1,
"key": "page",
"value": "1",
"not_null": -1,
"type": "Text"
},
{
"description": "每页条数,值为-1,查询所有记录",
"field_type": "Integer",
"is_checked": 1,
"key": "size",
"value": "10",
"not_null": -1,
"type": "Text"
},
{
"description": "第一级组织",
"field_type": "String",
"is_checked": 1,
"key": "firstOrganize",
"value": "Window",
"not_null": -1,
"type": "Text"
},
{
"description": "第二级组织",
"field_type": "String",
"is_checked": 1,
"key": "secondOrganize",
"value": "hongqi",
"not_null": -1,
"type": "Text"
},
{
"description": "参数key",
"field_type": "String",
"is_checked": 1,
"key": "key",
"value": "test",
"not_null": -1,
"type": "Text"
}
],
"raw_schema": {
"type": "object",
"properties": {
"page": {
"type": "integer",
"description": "当前页",
"mock": {
"mock": "@integer(1,10)"
}
},
"size": {
"type": "integer",
"description": "每页条数,值为-1,查询所有记录",
"mock": {
"mock": "@integer(-1,100)"
}
},
"firstOrganize": {
"type": "string",
"description": "第一级组织",
"mock": {
"mock": "firstOrganize"
}
},
"secondOrganize": {
"type": "string",
"mock": {
"mock": "secondOrganize"
},
"description": "第二集组织"
},
"paramKey": {
"type": "string",
"description": "参数key",
"mock": {
"mock": "key"
}
}
},
"required": [
"page",
"size"
],
"APIPOST_ORDERS": [
"page",
"size",
"firstOrganize",
"secondOrganize",
"paramKey"
],
"description": ""
}
}
},
"response": {
"success": {
"raw": "{\n\t\"data\": {\n\t\t\"data\": [\n\t\t\t{\n\t\t\t\t\"id\": 74,\n\t\t\t\t\"name\": \"crmtb\",\n\t\t\t\t\"paramKey\": \"duodbh\",\n\t\t\t\t\"paramValue\": \"xuccnvif\"\n\t\t\t}\n\t\t]\n\t},\n\t\"code\": 1,\n\t\"msg\": \"查询成功\"\n}",
"parameter": [
{
"description": "",
"field_type": "object",
"is_checked": 1,
"key": "",
"not_null": true,
"type": "object",
"value": "-"
},
{
"description": "",
"field_type": "object",
"is_checked": 1,
"key": "data",
"not_null": true,
"type": "object",
"value": "-"
},
{
"description": "",
"field_type": "array",
"is_checked": 1,
"key": "data.data",
"not_null": true,
"type": "array",
"value": "-"
},
{
"description": "",
"field_type": "object",
"is_checked": 1,
"key": "data.data.0",
"not_null": true,
"type": "object",
"value": "-"
},
{
"description": "ID",
"field_type": "integer",
"is_checked": 1,
"key": "data.data.0.id",
"not_null": true,
"type": "integer",
"value": 74
},
{
"description": "名称",
"field_type": "string",
"is_checked": 1,
"key": "data.data.0.name",
"not_null": true,
"type": "string",
"value": "crmtb"
},
{
"description": "参数键key",
"field_type": "string",
"is_checked": 1,
"key": "data.data.0.paramKey",
"not_null": true,
"type": "string",
"value": "duodbh"
},
{
"description": "参数值",
"field_type": "string",
"is_checked": 1,
"key": "data.data.0.paramValue",
"not_null": true,
"type": "string",
"value": "xuccnvif"
},
{
"description": "结果码",
"field_type": "integer",
"is_checked": 1,
"key": "code",
"not_null": true,
"type": "integer",
"value": 1
},
{
"description": "描述消息",
"field_type": "string",
"is_checked": 1,
"key": "msg",
"not_null": true,
"type": "string",
"value": "查询成功"
}
],
"expect": {
"name": "成功",
"isDefault": 1,
"code": 200,
"contentType": "json",
"verifyType": "schema",
"mock": "",
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"mock": {
"mock": "@integer(1,100)"
},
"description": "ID"
},
"name": {
"type": "string",
"mock": {
"mock": "@word()"
},
"description": "名称"
},
"paramKey": {
"type": "string",
"mock": {
"mock": "@word()"
},
"description": "参数键key"
},
"paramValue": {
"type": "string",
"mock": {
"mock": "@word()"
},
"description": "参数值"
}
},
"required": [
"id",
"name",
"paramKey",
"paramValue"
],
"APIPOST_ORDERS": [
"id",
"name",
"paramKey",
"paramValue"
]
}
}
},
"required": [
"data"
],
"APIPOST_ORDERS": [
"data"
]
},
"code": {
"type": "integer",
"mock": {
"mock": "1"
},
"description": "结果码"
},
"msg": {
"type": "string",
"mock": {
"mock": "查询成功"
},
"description": "描述消息"
}
},
"required": [
"data",
"code",
"msg"
],
"APIPOST_ORDERS": [
"data",
"code",
"msg"
]
}
}
},
"error": {
"raw": "",
"parameter": [],
"expect": {
"name": "失败",
"isDefault": -1,
"code": 404,
"contentType": "json",
"verifyType": "schema",
"mock": "",
"schema": {
"type": "object"
}
}
}
},
"children": []
}
]
]
},
},
<#list tableList as table>
<#list tableList as table>
...
...
appbuild-manager/src/main/resources/template/vue/VueDrawerShow.vue.ftl
View file @
6c037f57
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
:title="title"
:title="title"
:visible.sync="open"
:visible.sync="open"
:direction="direction"
:direction="direction"
:destroy-on-close="true"
size="50%">
size="50%">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-row>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment