update:update gen code temp

This commit is contained in:
zhangwenjian committed 2020-08-29 16:32:59 +08:00
1 parent 3063386ec6
commit 77499b50cc
6 files changed
+63 -73

No files matched your search

+6 -13
View File
@@ -17,25 +17,18 @@ func Get{{.ClassName}}List(c *gin.Context) {
var pageIndex = 1
if size := c.Request.FormValue("pageSize"); size != "" {
pageSize = tools.StrToInt(err, size)
pageSize, err = tools.StringToInt(size)
}
if index := c.Request.FormValue("pageIndex"); index != "" {
pageIndex = tools.StrToInt(err, index)
pageIndex, err = tools.StringToInt(index)
}
{{ range .Columns -}}
{{$z := .IsQuery}}
{{- if ($z) -}}
{{ if eq (.GoType) "int" -}}
data.{{.GoField}}, _ = tools.StringToInt(c.Request.FormValue("{{.JsonField}}"))
{{ else -}}
data.{{.GoField}} = c.Request.FormValue("{{.JsonField}}")
{{ end }}
{{- end -}}
{{end}}
var v dto.{{.ClassName}}Search
err = c.Bind(&v)
tools.HasError(err, "数据解析失败", 422)
data.DataScope = tools.GetUserIdStr(c)
result, count, err := data.GetPage(pageSize, pageIndex)
result, count, err := data.GetPage(pageSize, pageIndex, v)
tools.HasError(err, "", -1)
app.PageOK(c, result, count, pageIndex, pageSize, "")