mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 02:04:09 +00:00
修复模版不兼容actions模式生成
迁移重复问题
This commit is contained in:
@@ -4,9 +4,9 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"go-admin/app/{{.PackageName}}/models"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/common/dto"
|
||||
"go-admin/common/apis"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
type {{.ClassName}}Search struct {
|
||||
@@ -24,6 +24,11 @@ func (m *{{.ClassName}}Search) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
func (m *{{.ClassName}}Search) Generate() dto.Index {
|
||||
o := *m
|
||||
return &o
|
||||
}
|
||||
|
||||
func (m *{{.ClassName}}Search) Bind(ctx *gin.Context) error {
|
||||
log := apis.GetRequestLogger(ctx)
|
||||
err := ctx.ShouldBind(m)
|
||||
@@ -49,6 +54,11 @@ type {{.ClassName}}Control struct {
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
func (s *{{.ClassName}}Control) Generate() dto.Control {
|
||||
o := *s
|
||||
return &o
|
||||
}
|
||||
|
||||
func (s *{{.ClassName}}Control) Bind(ctx *gin.Context) error {
|
||||
log := apis.GetRequestLogger(ctx)
|
||||
err := ctx.ShouldBindUri(s)
|
||||
@@ -63,7 +73,7 @@ func (s *{{.ClassName}}Control) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *{{.ClassName}}Control) Generate() (*models.{{.ClassName}}, error) {
|
||||
func (s *{{.ClassName}}Control) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.{{.ClassName}}{
|
||||
{{ range .Columns -}}
|
||||
{{$x := .Pk}}
|
||||
@@ -86,8 +96,7 @@ func (s *{{.ClassName}}Control) GetId() interface{} {
|
||||
}
|
||||
|
||||
type {{.ClassName}}ById struct {
|
||||
Id int `uri:"id"`
|
||||
Ids []int `json:"ids"`
|
||||
dto.ObjectById
|
||||
}
|
||||
|
||||
func (s *{{.ClassName}}ById) GetId() interface{} {
|
||||
@@ -114,4 +123,13 @@ func (s *{{.ClassName}}ById) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *{{.ClassName}}ById) SetUpdateBy(id int) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func (s *{{.ClassName}}ById) Generate() dto.Control {
|
||||
o := *s
|
||||
return &o
|
||||
}
|
||||
|
||||
func (s *{{.ClassName}}ById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.{{.ClassName}}{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user