【更新】更新swagger文档

This commit is contained in:
PandaGoAdmin
2022-08-04 16:57:18 +08:00
parent 6db51fb2c9
commit 6d893f7c4e
39 changed files with 439 additions and 214 deletions

View File

@@ -1,6 +1,7 @@
package router
import (
"github.com/XM-GO/PandaKit/model"
"github.com/XM-GO/PandaKit/restfulx"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/emicklei/go-restful/v3"
@@ -23,17 +24,22 @@ func InitPostRouter(container *restful.Container) {
restfulx.NewReqCtx(request, response).WithLog("获取岗位分页列表").Handle(s.GetPostList)
}).
Doc("获取岗位分页列表").
Param(ws.QueryParameter("pageNum", "页数").Required(true).DataType("int")).
Param(ws.QueryParameter("pageSize", "每页条数").Required(true).DataType("int")).
Param(ws.QueryParameter("status", "status").DataType("string")).
Param(ws.QueryParameter("postName", "postName").DataType("string")).
Param(ws.QueryParameter("postCode", "postCode").DataType("string")).
Metadata(restfulspec.KeyOpenAPITags, tags).
Writes([]entity.SysPost{}).
Returns(200, "OK", []entity.SysPost{}))
Writes(model.ResultPage{}).
Returns(200, "OK", model.ResultPage{}))
ws.Route(ws.GET("/{postId}").To(func(request *restful.Request, response *restful.Response) {
restfulx.NewReqCtx(request, response).WithLog("获取岗位信息").Handle(s.GetPost)
}).
Doc("获取岗位信息").
Param(ws.PathParameter("postId", "Id").DataType("int").DefaultValue("1")).
Param(ws.PathParameter("postId", "Id").DataType("int")).
Metadata(restfulspec.KeyOpenAPITags, tags).
Writes(entity.SysPost{}). // on the response
Writes(entity.SysPost{}).
Returns(200, "OK", entity.SysPost{}).
Returns(404, "Not Found", nil))
@@ -42,14 +48,14 @@ func InitPostRouter(container *restful.Container) {
}).
Doc("添加岗位信息").
Metadata(restfulspec.KeyOpenAPITags, tags).
Reads(entity.SysPost{})) // from the request
Reads(entity.SysPost{}))
ws.Route(ws.PUT("").To(func(request *restful.Request, response *restful.Response) {
restfulx.NewReqCtx(request, response).WithLog("修改岗位信息").Handle(s.UpdatePost)
}).
Doc("修改岗位信息").
Metadata(restfulspec.KeyOpenAPITags, tags).
Reads(entity.SysPost{})) // from the request
Reads(entity.SysPost{}))
ws.Route(ws.DELETE("/{postId}").To(func(request *restful.Request, response *restful.Response) {
restfulx.NewReqCtx(request, response).WithLog("删除岗位信息").Handle(s.DeletePost)