mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-27 00:49:36 +08:00
【更新】更新swagger文档
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
restfulspec "github.com/emicklei/go-restful-openapi/v2"
|
||||
"github.com/emicklei/go-restful/v3"
|
||||
"pandax/apps/system/api"
|
||||
"pandax/apps/system/api/vo"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
)
|
||||
@@ -26,21 +27,29 @@ func InitDeptRouter(container *restful.Container) {
|
||||
Doc("获取角色部门树").
|
||||
Param(ws.PathParameter("roleId", "角色Id").DataType("int").DefaultValue("1")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Writes(map[string]any{}). // on the response
|
||||
Writes(vo.DeptTreeVo{}).
|
||||
Returns(200, "OK", vo.DeptTreeVo{}).
|
||||
Returns(404, "Not Found", nil))
|
||||
|
||||
ws.Route(ws.GET("/deptTree").To(func(request *restful.Request, response *restful.Response) {
|
||||
restfulx.NewReqCtx(request, response).WithLog("获取所有部门树").Handle(s.GetDeptTree)
|
||||
}).
|
||||
Doc("获取所有部门树").
|
||||
Param(ws.QueryParameter("deptName", "deptName").DataType("string")).
|
||||
Param(ws.QueryParameter("status", "status").DataType("string")).
|
||||
Param(ws.QueryParameter("deptId", "deptId").DataType("int")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Writes([]entity.SysDept{}). // on the response
|
||||
Writes([]entity.SysDept{}).
|
||||
Returns(200, "OK", []entity.SysDept{}).
|
||||
Returns(404, "Not Found", nil))
|
||||
|
||||
ws.Route(ws.GET("/list").To(func(request *restful.Request, response *restful.Response) {
|
||||
restfulx.NewReqCtx(request, response).WithLog("获取部门列表").Handle(s.GetDeptList)
|
||||
}).
|
||||
Doc("获取部门列表").
|
||||
Param(ws.QueryParameter("deptName", "deptName").DataType("string")).
|
||||
Param(ws.QueryParameter("status", "status").DataType("string")).
|
||||
Param(ws.QueryParameter("deptId", "deptId").DataType("int")).
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Writes([]entity.SysDept{}).
|
||||
Returns(200, "OK", []entity.SysDept{}))
|
||||
@@ -60,14 +69,14 @@ func InitDeptRouter(container *restful.Container) {
|
||||
}).
|
||||
Doc("添加部门信息").
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Reads(entity.SysDept{})) // from the request
|
||||
Reads(entity.SysDept{}))
|
||||
|
||||
ws.Route(ws.PUT("").To(func(request *restful.Request, response *restful.Response) {
|
||||
restfulx.NewReqCtx(request, response).WithLog("修改部门信息").Handle(s.UpdateDept)
|
||||
}).
|
||||
Doc("修改部门信息").
|
||||
Metadata(restfulspec.KeyOpenAPITags, tags).
|
||||
Reads(entity.SysDept{})) // from the request
|
||||
Reads(entity.SysDept{}))
|
||||
|
||||
ws.Route(ws.DELETE("/{deptId}").To(func(request *restful.Request, response *restful.Response) {
|
||||
restfulx.NewReqCtx(request, response).WithLog("删除部门信息").Handle(s.DeleteDept)
|
||||
|
||||
Reference in New Issue
Block a user