Merge branch 'gin-vue-admin_v2_dev' of G:\QMPlus with conflicts.

This commit is contained in:
pixel
2020-06-01 11:18:13 +08:00
parent 5cb3d7bc86
commit 318f688259
7 changed files with 304 additions and 354 deletions
+17 -22
View File
@@ -2,15 +2,14 @@ package v1
import (
"fmt"
"gin-vue-admin/global/response"
"gin-vue-admin/model"
"gin-vue-admin/model/request"
resp "gin-vue-admin/model/response"
"gin-vue-admin/service"
"github.com/gin-gonic/gin"
"gin-vue-admin/global/response"
"gin-vue-admin/model"
"gin-vue-admin/model/request"
resp "gin-vue-admin/model/response"
"gin-vue-admin/service"
"github.com/gin-gonic/gin"
)
// @Tags {{.StructName}}
// @Summary 创建{{.StructName}}
// @Security ApiKeyAuth
@@ -30,7 +29,6 @@ func Create{{.StructName}}(c *gin.Context) {
}
}
// @Tags {{.StructName}}
// @Summary 删除{{.StructName}}
// @Security ApiKeyAuth
@@ -50,7 +48,6 @@ func Delete{{.StructName}}(c *gin.Context) {
}
}
// @Tags {{.StructName}}
// @Summary 更新{{.StructName}}
// @Security ApiKeyAuth
@@ -70,7 +67,6 @@ func Update{{.StructName}}(c *gin.Context) {
}
}
// @Tags {{.StructName}}
// @Summary 用id查询{{.StructName}}
// @Security ApiKeyAuth
@@ -82,15 +78,14 @@ func Update{{.StructName}}(c *gin.Context) {
func Find{{.StructName}}(c *gin.Context) {
var {{.Abbreviation}} model.{{.StructName}}
_ = c.ShouldBindQuery(&{{.Abbreviation}})
err,re{{.Abbreviation}} := service.Get{{.StructName}}({{.Abbreviation}}.ID)
err, re{{.Abbreviation}} := service.Get{{.StructName}}({{.Abbreviation}}.ID)
if err != nil {
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
} else {
response.OkWithData( gin.H{"re{{.Abbreviation}}":re{{.Abbreviation}},}, c)
response.OkWithData(gin.H{"re{{.Abbreviation}}": re{{.Abbreviation}}}, c)
}
}
// @Tags {{.StructName}}
// @Summary 分页获取{{.StructName}}列表
// @Security ApiKeyAuth
@@ -104,13 +99,13 @@ func Get{{.StructName}}List(c *gin.Context) {
_ = c.ShouldBindQuery(&pageInfo)
err, list, total := service.Get{{.StructName}}InfoList(pageInfo)
if err != nil {
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
} else {
response.OkWithData(resp.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, c)
response.OkWithData(resp.PageResult{
List: list,
Total: total,
Page: pageInfo.Page,
PageSize: pageInfo.PageSize,
}, c)
}
}
}