mirror of
https://github.com/tiger1103/gfast.git
synced 2026-09-21 10:12:59 +00:00
添加swagger API接口文档
This commit is contained in:
+321
@@ -0,0 +1,321 @@
|
||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// This file was generated by swaggo/swag
|
||||
|
||||
package swagger
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/template"
|
||||
"github.com/swaggo/swag"
|
||||
)
|
||||
|
||||
var doc = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{.Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {},
|
||||
"license": {},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/system/dept/addDept": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "添加部门",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "data",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/sys_dept.AddParams"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 0, \"message\": \"添加成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/dept/delDept/{id}": {
|
||||
"delete": {
|
||||
"description": "删除数据",
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "删除部门",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 0, \"message\": \"删除成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/dept/editDept": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "修改部门",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "data",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/sys_dept.EditParams"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 0, \"message\": \"修改成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/dept/list": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"": []
|
||||
}
|
||||
],
|
||||
"description": "分页列表",
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "分页部门列表数据",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "deptName",
|
||||
"name": "deptName",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "status",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"0": {
|
||||
"description": "{\"code\": 200, \"data\": [...]}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"response.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "代码",
|
||||
"type": "integer",
|
||||
"example": 200
|
||||
},
|
||||
"data": {
|
||||
"description": "数据集",
|
||||
"type": "object"
|
||||
},
|
||||
"msg": {
|
||||
"description": "消息",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sys_dept.AddParams": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ancestors": {
|
||||
"type": "string"
|
||||
},
|
||||
"createBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createTime": {
|
||||
"type": "string"
|
||||
},
|
||||
"delFlag": {
|
||||
"type": "string"
|
||||
},
|
||||
"deptName": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"leader": {
|
||||
"type": "string"
|
||||
},
|
||||
"orderNum": {
|
||||
"type": "integer"
|
||||
},
|
||||
"parentId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateTime": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sys_dept.EditParams": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ancestors": {
|
||||
"type": "string"
|
||||
},
|
||||
"createBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createTime": {
|
||||
"type": "string"
|
||||
},
|
||||
"delFlag": {
|
||||
"type": "string"
|
||||
},
|
||||
"deptId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"deptName": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"leader": {
|
||||
"type": "string"
|
||||
},
|
||||
"orderNum": {
|
||||
"type": "integer"
|
||||
},
|
||||
"parentId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateTime": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
type swaggerInfo struct {
|
||||
Version string
|
||||
Host string
|
||||
BasePath string
|
||||
Schemes []string
|
||||
Title string
|
||||
Description string
|
||||
}
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = swaggerInfo{
|
||||
Version: "1.0",
|
||||
Host: "localhost",
|
||||
BasePath: "/system",
|
||||
Schemes: []string{},
|
||||
Title: "gfast API文档",
|
||||
Description: "gfast 在线API文档",
|
||||
}
|
||||
|
||||
type s struct{}
|
||||
|
||||
func (s *s) ReadDoc() string {
|
||||
sInfo := SwaggerInfo
|
||||
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
|
||||
|
||||
t, err := template.New("swagger_info").Funcs(template.FuncMap{
|
||||
"marshal": func(v interface{}) string {
|
||||
a, _ := json.Marshal(v)
|
||||
return string(a)
|
||||
},
|
||||
}).Parse(doc)
|
||||
if err != nil {
|
||||
return doc
|
||||
}
|
||||
|
||||
var tpl bytes.Buffer
|
||||
if err := t.Execute(&tpl, sInfo); err != nil {
|
||||
return doc
|
||||
}
|
||||
|
||||
return tpl.String()
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(swag.Name, &s{})
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "gfast 在线API文档",
|
||||
"title": "gfast API文档",
|
||||
"contact": {},
|
||||
"license": {},
|
||||
"version": "1.0"
|
||||
},
|
||||
"host": "localhost",
|
||||
"basePath": "/system",
|
||||
"paths": {
|
||||
"/system/dept/addDept": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "添加部门",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "data",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/sys_dept.AddParams"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 0, \"message\": \"添加成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/dept/delDept/{id}": {
|
||||
"delete": {
|
||||
"description": "删除数据",
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "删除部门",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "id",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 0, \"message\": \"删除成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/dept/editDept": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
}
|
||||
],
|
||||
"description": "获取JSON",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "修改部门",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "data",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/sys_dept.EditParams"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": 0, \"message\": \"修改成功\"}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/dept/list": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"": []
|
||||
}
|
||||
],
|
||||
"description": "分页列表",
|
||||
"tags": [
|
||||
"部门"
|
||||
],
|
||||
"summary": "分页部门列表数据",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "deptName",
|
||||
"name": "deptName",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "status",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"0": {
|
||||
"description": "{\"code\": 200, \"data\": [...]}",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"response.Response": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "代码",
|
||||
"type": "integer",
|
||||
"example": 200
|
||||
},
|
||||
"data": {
|
||||
"description": "数据集",
|
||||
"type": "object"
|
||||
},
|
||||
"msg": {
|
||||
"description": "消息",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sys_dept.AddParams": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ancestors": {
|
||||
"type": "string"
|
||||
},
|
||||
"createBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createTime": {
|
||||
"type": "string"
|
||||
},
|
||||
"delFlag": {
|
||||
"type": "string"
|
||||
},
|
||||
"deptName": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"leader": {
|
||||
"type": "string"
|
||||
},
|
||||
"orderNum": {
|
||||
"type": "integer"
|
||||
},
|
||||
"parentId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateTime": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sys_dept.EditParams": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ancestors": {
|
||||
"type": "string"
|
||||
},
|
||||
"createBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createTime": {
|
||||
"type": "string"
|
||||
},
|
||||
"delFlag": {
|
||||
"type": "string"
|
||||
},
|
||||
"deptId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"deptName": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"leader": {
|
||||
"type": "string"
|
||||
},
|
||||
"orderNum": {
|
||||
"type": "integer"
|
||||
},
|
||||
"parentId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updateTime": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
basePath: /system
|
||||
definitions:
|
||||
response.Response:
|
||||
properties:
|
||||
code:
|
||||
description: 代码
|
||||
example: 200
|
||||
type: integer
|
||||
data:
|
||||
description: 数据集
|
||||
type: object
|
||||
msg:
|
||||
description: 消息
|
||||
type: string
|
||||
type: object
|
||||
sys_dept.AddParams:
|
||||
properties:
|
||||
ancestors:
|
||||
type: string
|
||||
createBy:
|
||||
type: string
|
||||
createTime:
|
||||
type: string
|
||||
delFlag:
|
||||
type: string
|
||||
deptName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
leader:
|
||||
type: string
|
||||
orderNum:
|
||||
type: integer
|
||||
parentId:
|
||||
type: integer
|
||||
phone:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
updateBy:
|
||||
type: string
|
||||
updateTime:
|
||||
type: string
|
||||
type: object
|
||||
sys_dept.EditParams:
|
||||
properties:
|
||||
ancestors:
|
||||
type: string
|
||||
createBy:
|
||||
type: string
|
||||
createTime:
|
||||
type: string
|
||||
delFlag:
|
||||
type: string
|
||||
deptId:
|
||||
type: integer
|
||||
deptName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
leader:
|
||||
type: string
|
||||
orderNum:
|
||||
type: integer
|
||||
parentId:
|
||||
type: integer
|
||||
phone:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
updateBy:
|
||||
type: string
|
||||
updateTime:
|
||||
type: string
|
||||
type: object
|
||||
host: localhost
|
||||
info:
|
||||
contact: {}
|
||||
description: gfast 在线API文档
|
||||
license: {}
|
||||
title: gfast API文档
|
||||
version: "1.0"
|
||||
paths:
|
||||
/system/dept/addDept:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 获取JSON
|
||||
parameters:
|
||||
- description: data
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/sys_dept.AddParams'
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": 0, "message": "添加成功"}'
|
||||
schema:
|
||||
$ref: '#/definitions/response.Response'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: 添加部门
|
||||
tags:
|
||||
- 部门
|
||||
/system/dept/delDept/{id}:
|
||||
delete:
|
||||
description: 删除数据
|
||||
parameters:
|
||||
- description: id
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": 0, "message": "删除成功"}'
|
||||
schema:
|
||||
$ref: '#/definitions/response.Response'
|
||||
summary: 删除部门
|
||||
tags:
|
||||
- 部门
|
||||
/system/dept/editDept:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 获取JSON
|
||||
parameters:
|
||||
- description: data
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/sys_dept.EditParams'
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": 0, "message": "修改成功"}'
|
||||
schema:
|
||||
$ref: '#/definitions/response.Response'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: 修改部门
|
||||
tags:
|
||||
- 部门
|
||||
/system/dept/list:
|
||||
get:
|
||||
description: 分页列表
|
||||
parameters:
|
||||
- description: deptName
|
||||
in: query
|
||||
name: deptName
|
||||
type: string
|
||||
- description: status
|
||||
in: query
|
||||
name: status
|
||||
type: string
|
||||
responses:
|
||||
"0":
|
||||
description: '{"code": 200, "data": [...]}'
|
||||
schema:
|
||||
$ref: '#/definitions/response.Response'
|
||||
security:
|
||||
- "": []
|
||||
summary: 分页部门列表数据
|
||||
tags:
|
||||
- 部门
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user