Commit 6c037f57 authored by 赵啸非's avatar 赵啸非

添加apipost生成接口文档逻辑

parent 091c103a
......@@ -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 {
List<GentableEntity> tableList = new ArrayList<>();
tableList.add(gentableEntity);
......@@ -276,7 +276,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
FreeMarkerUtils.initFreeMarker(genFreePath("api.md.ftl"));
zipTemplate("api.md.ftl", "doc/api.md", data, zip);
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);
return outputStream.toByteArray();
......@@ -307,7 +307,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
zipTemplate("dm_db.sql.ftl", "db/dm_db.sql", data, zip);
FreeMarkerUtils.initFreeMarker(genFreePath("api.md.ftl"));
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);
return outputStream.toByteArray();
}
......@@ -476,6 +476,7 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
String temp2 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
GenUtils.checkDict(column, temp1);
GenUtils.checkDict(column, temp2);
column.setColumnComment(StrUtil.removeAllLineBreaks(column.getColumnComment()));
return column;
}).collect(Collectors.toList());
......@@ -616,7 +617,6 @@ public class GentableServiceImpl extends AbstractCRUDServiceImpl<GentableDao, Ge
}
/**
* 生成文档
*/
......
......@@ -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>
......
......@@ -4,6 +4,7 @@
:title="title"
:visible.sync="open"
:direction="direction"
:destroy-on-close="true"
size="50%">
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment