修复swagger无法生成文档

This commit is contained in:
linwenxiang committed 2021-03-24 18:52:59 +08:00
1 parent 6fb7da87a3
commit 12893fc09d
31 files changed
+2032 -2442

No files matched your search

+11 -17
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models"
"go-admin/app/admin/service"
@@ -23,13 +24,10 @@ type {{.ClassName}} struct {
{{ $tablename := .TBName -}}
{{ range .Columns -}}
{{$z := .IsQuery}}
{{- if ($z) -}}
// @Param {{.JsonField}} query {{.GoType}} false "{{.ColumnComment}}"
{{ end -}}
{{- end }}
{{- if ($z) -}}// @Param {{.JsonField}} query {{.GoType}} false "{{.ColumnComment}}"{{ end -}}{{- end }}
// @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
// @Success 200 {object} response.Response{data=response.Page{list=[]models.{{.ClassName}}}} "{"code": 200, "data": [...]}"
// @Router /api/v1/{{.ModuleName}} [get]
// @Security Bearer
// Get{{.ClassName}}List 获取{{.TableComment}}列表
@@ -72,9 +70,8 @@ func (e *{{.ClassName}}) Get{{.ClassName}}List(c *gin.Context) {
// @Description 获取{{.TableComment}}
// @Tags {{.TableComment}}
// @Param id path string false "id"
// @Success 200 {string} string "{"code": 200, "data": [...]}"
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
// @Router /api/v1/{{.ModuleName}} [get]
// @Success 200 {object} response.Response{data=models.{{.ClassName}}} "{"code": 200, "data": [...]}"
// @Router /api/v1/{{.ModuleName}}/{id} [get]
// @Security Bearer
// Get{{.ClassName}} 获取{{.TableComment}}
func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) {
@@ -118,9 +115,8 @@ func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) {
// @Accept application/json
// @Product application/json
// @Param data body dto.{{.ClassName}}Control true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/{{.ClassName}} [post]
// @Success 200 {object} response.Response "{"code": 200, "message": "添加成功"}"
// @Router /api/v1/{{.ModuleName}} [post]
// Insert{{.ClassName}} 创建{{.TableComment}}
func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) {
log := e.GetLogger(c)
@@ -167,9 +163,8 @@ func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) {
// @Accept application/json
// @Product application/json
// @Param data body dto.{{.ClassName}}Control true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
// @Router /api/v1/{{.ClassName}} [put]
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
// @Router /api/v1/{{.ModuleName}} [put]
// Update{{.ClassName}} 修改{{.TableComment}}
func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) {
log := e.GetLogger(c)
@@ -216,9 +211,8 @@ func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) {
// @Tags {{.TableComment}}
// @Param id path int false "id"
// @Param ids body string false "ids"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Router /api/v1/{{.ClassName}}/{id} [delete]
// @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}"
// @Router /api/v1/{{.ModuleName}}/{id} [delete]
// Delete{{.ClassName}} 删除{{.TableComment}}
func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) {
log := e.GetLogger(c)