From 8f1692e39454001582ac60864fd772e46b34dcae Mon Sep 17 00:00:00 2001 From: Wall <307606056@qq.com> Date: Tue, 18 Jun 2024 13:17:09 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fixed:=20=E4=BF=AE=E5=A4=8D=E7=94=9F?= =?UTF-8?q?=E6=88=90=E4=BB=A3=E7=A0=81element-ui=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E8=AD=A6=E5=91=8A=E9=97=AE=E9=A2=98=20(#1787?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixed: 修复生成代码element-ui接口启用警告问题 --------- Co-authored-by: wall-js --- server/resource/autocode_template/web/table.vue.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/resource/autocode_template/web/table.vue.tpl b/server/resource/autocode_template/web/table.vue.tpl index cb9dbb3056..cd2a725557 100644 --- a/server/resource/autocode_template/web/table.vue.tpl +++ b/server/resource/autocode_template/web/table.vue.tpl @@ -142,8 +142,8 @@ 查询 重置 - 展开 - 收起 + 展开 + 收起 From d6703e82e2fed3f56429afabf09cb737c8613f10 Mon Sep 17 00:00:00 2001 From: Wall <307606056@qq.com> Date: Thu, 20 Jun 2024 17:45:56 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fixed:=20=E4=BF=AE=E5=A4=8D=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E4=BB=A3=E7=A0=81form=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=EF=BC=8Cfind=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4=E6=9C=AA?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=8C=E5=85=A8=20(#1790)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: wall-js --- server/resource/autocode_template/web/form.vue.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/resource/autocode_template/web/form.vue.tpl b/server/resource/autocode_template/web/form.vue.tpl index 14df8d3504..9e7c0f9ab7 100644 --- a/server/resource/autocode_template/web/form.vue.tpl +++ b/server/resource/autocode_template/web/form.vue.tpl @@ -176,7 +176,7 @@ const init = async () => { if (route.query.id) { const res = await find{{.StructName}}({ ID: route.query.id }) if (res.code === 0) { - formData.value = res.data.re{{.Abbreviation}} + formData.value = res.data type.value = 'update' } } else { From 35c203ceb9bd9f1cc3e1cc9a5697aab5d0338206 Mon Sep 17 00:00:00 2001 From: SliverHorn Date: Fri, 21 Jun 2024 09:23:02 +0800 Subject: [PATCH 3/6] Update: 1. request.go.tpl and model.go.tpl indent problem 2. api.go.tpl, request.go.tpl, service.go.tpl struct {} --- .../autocode_template/server/api.go.tpl | 3 +- .../autocode_template/server/model.go.tpl | 61 ++++++++++--------- .../autocode_template/server/request.go.tpl | 50 +++++++-------- .../autocode_template/server/router.go.tpl | 3 +- .../autocode_template/server/service.go.tpl | 3 +- 5 files changed, 60 insertions(+), 60 deletions(-) diff --git a/server/resource/autocode_template/server/api.go.tpl b/server/resource/autocode_template/server/api.go.tpl index 61cd2fa0d8..dd41bf577e 100644 --- a/server/resource/autocode_template/server/api.go.tpl +++ b/server/resource/autocode_template/server/api.go.tpl @@ -13,8 +13,7 @@ import ( {{- end }} ) -type {{.StructName}}Api struct { -} +type {{.StructName}}Api struct {} var {{.Abbreviation}}Service = service.ServiceGroupApp.{{.PackageT}}ServiceGroup.{{.StructName}}Service diff --git a/server/resource/autocode_template/server/model.go.tpl b/server/resource/autocode_template/server/model.go.tpl index 06e46d95bc..308d0bcb7f 100644 --- a/server/resource/autocode_template/server/model.go.tpl +++ b/server/resource/autocode_template/server/model.go.tpl @@ -9,39 +9,42 @@ import ( // {{.Description}} 结构体 {{.StructName}} type {{.StructName}} struct { -{{ if .GvaModel }} global.GVA_MODEL {{ end }} - {{- range .Fields}} - {{- if eq .FieldType "enum" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};type:enum({{.DataTypeLong}});comment:{{.Comment}};" {{- if .Require }} binding:"required"{{- end -}}` - {{- else if eq .FieldType "picture" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` - {{- else if eq .FieldType "video" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` - {{- else if eq .FieldType "file" }} - {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"` - {{- else if eq .FieldType "pictures" }} - {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"` - {{- else if eq .FieldType "richtext" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}` - {{- else if eq .FieldType "json" }} - {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"` - {{- else if eq .FieldType "array" }} - {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"` - {{- else if ne .FieldType "string" }} - {{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` - {{- else }} - {{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` - {{- end }} {{ if .FieldDesc }}//{{.FieldDesc}} {{ end }} {{- end }} - {{- if .AutoCreateResource }} - CreatedBy uint `gorm:"column:created_by;comment:创建者"` - UpdatedBy uint `gorm:"column:updated_by;comment:更新者"` - DeletedBy uint `gorm:"column:deleted_by;comment:删除者"` - {{- end}} +{{- if .GvaModel }} + global.GVA_MODEL +{{- end }} +{{- range .Fields}} + {{- if eq .FieldType "enum" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};type:enum({{.DataTypeLong}});comment:{{.Comment}};" {{- if .Require }} binding:"required"{{- end -}}` + {{- else if eq .FieldType "picture" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` + {{- else if eq .FieldType "video" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` + {{- else if eq .FieldType "file" }} + {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"` + {{- else if eq .FieldType "pictures" }} + {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"` + {{- else if eq .FieldType "richtext" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}` + {{- else if eq .FieldType "json" }} + {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"` + {{- else if eq .FieldType "array" }} + {{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"` + {{- else if ne .FieldType "string" }} + {{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` + {{- else }} + {{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}` + {{- end }} {{ if .FieldDesc }}//{{.FieldDesc}} {{ end }} +{{- end }} + {{- if .AutoCreateResource }} + CreatedBy uint `gorm:"column:created_by;comment:创建者"` + UpdatedBy uint `gorm:"column:updated_by;comment:更新者"` + DeletedBy uint `gorm:"column:deleted_by;comment:删除者"` + {{- end }} } {{ if .TableName }} // TableName {{.Description}} {{.StructName}}自定义表名 {{.TableName}} func ({{.StructName}}) TableName() string { - return "{{.TableName}}" + return "{{.TableName}}" } {{ end }} diff --git a/server/resource/autocode_template/server/request.go.tpl b/server/resource/autocode_template/server/request.go.tpl index 461832bea9..db43825ee5 100644 --- a/server/resource/autocode_template/server/request.go.tpl +++ b/server/resource/autocode_template/server/request.go.tpl @@ -6,32 +6,32 @@ import ( ) type {{.StructName}}Search struct{ - {{ if .GvaModel }} - StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"` - EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"` - {{ end }} - {{- range .Fields}} - {{- if ne .FieldSearchType ""}} - {{- if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}} - Start{{.FieldName}} *{{.FieldType}} `json:"start{{.FieldName}}" form:"start{{.FieldName}}"` - End{{.FieldName}} *{{.FieldType}} `json:"end{{.FieldName}}" form:"end{{.FieldName}}"` - {{- else }} - {{- if eq .FieldType "enum" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}"` - {{- else if eq .FieldType "picture" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` - {{- else if eq .FieldType "video" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` - {{- else if eq .FieldType "richtext" }} - {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` - {{- else if ne .FieldType "string" }} - {{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` - {{- else }} - {{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` - {{- end }} +{{- if .GvaModel }} + StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"` + EndCreatedAt *time.Time `json:"endCreatedAt" form:"endCreatedAt"` +{{- end }} +{{- range .Fields}} + {{- if ne .FieldSearchType ""}} + {{- if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}} + Start{{.FieldName}} *{{.FieldType}} `json:"start{{.FieldName}}" form:"start{{.FieldName}}"` + End{{.FieldName}} *{{.FieldType}} `json:"end{{.FieldName}}" form:"end{{.FieldName}}"` + {{- else }} + {{- if eq .FieldType "enum" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}"` + {{- else if eq .FieldType "picture" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` + {{- else if eq .FieldType "video" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` + {{- else if eq .FieldType "richtext" }} + {{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` + {{- else if ne .FieldType "string" }} + {{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` + {{- else }} + {{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" ` {{- end }} - {{- end}} - {{- end }} + {{- end }} + {{- end}} +{{- end }} request.PageInfo {{- if .NeedSort}} Sort string `json:"sort" form:"sort"` diff --git a/server/resource/autocode_template/server/router.go.tpl b/server/resource/autocode_template/server/router.go.tpl index b2b7325a3a..18b03f3918 100644 --- a/server/resource/autocode_template/server/router.go.tpl +++ b/server/resource/autocode_template/server/router.go.tpl @@ -6,8 +6,7 @@ import ( "github.com/gin-gonic/gin" ) -type {{.StructName}}Router struct { -} +type {{.StructName}}Router struct {} // Init{{.StructName}}Router 初始化 {{.Description}} 路由信息 func (s *{{.StructName}}Router) Init{{.StructName}}Router(Router *gin.RouterGroup,PublicRouter *gin.RouterGroup) { diff --git a/server/resource/autocode_template/server/service.go.tpl b/server/resource/autocode_template/server/service.go.tpl index 634af7ed28..625f9756ec 100644 --- a/server/resource/autocode_template/server/service.go.tpl +++ b/server/resource/autocode_template/server/service.go.tpl @@ -9,8 +9,7 @@ import ( {{- end}} ) -type {{.StructName}}Service struct { -} +type {{.StructName}}Service struct {} {{- $db := "" }} {{- if eq .BusinessDB "" }} From c60797cef379383f156395c9282de40a54dd414a Mon Sep 17 00:00:00 2001 From: SliverHorn Date: Fri, 21 Jun 2024 09:35:58 +0800 Subject: [PATCH 4/6] Update: 1. model.go.tpl import blank line --- server/resource/autocode_template/server/model.go.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/resource/autocode_template/server/model.go.tpl b/server/resource/autocode_template/server/model.go.tpl index 308d0bcb7f..dbc151e2bd 100644 --- a/server/resource/autocode_template/server/model.go.tpl +++ b/server/resource/autocode_template/server/model.go.tpl @@ -3,8 +3,8 @@ package {{.Package}} import ( {{ if .GvaModel }}"github.com/flipped-aurora/gin-vue-admin/server/global"{{ end }} - {{ if or .HasTimer }}"time"{{ end }} - {{ if .NeedJSON }}"gorm.io/datatypes"{{ end }} + {{- if or .HasTimer }}"time"{{ end }} + {{- if .NeedJSON }}"gorm.io/datatypes"{{ end }} ) // {{.Description}} 结构体 {{.StructName}} From df2bda2db359cba1ea299f78fcc1f10244e1d64e Mon Sep 17 00:00:00 2001 From: SliverHorn Date: Fri, 21 Jun 2024 09:39:50 +0800 Subject: [PATCH 5/6] Update: 1. model.go.tpl import blank line --- server/resource/autocode_template/server/model.go.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/resource/autocode_template/server/model.go.tpl b/server/resource/autocode_template/server/model.go.tpl index dbc151e2bd..ef8799659f 100644 --- a/server/resource/autocode_template/server/model.go.tpl +++ b/server/resource/autocode_template/server/model.go.tpl @@ -2,9 +2,9 @@ package {{.Package}} import ( - {{ if .GvaModel }}"github.com/flipped-aurora/gin-vue-admin/server/global"{{ end }} - {{- if or .HasTimer }}"time"{{ end }} - {{- if .NeedJSON }}"gorm.io/datatypes"{{ end }} + {{ if .GvaModel }}"github.com/flipped-aurora/gin-vue-admin/server/global"{{- end }} + {{ if or .HasTimer }}"time"{{ end }} + {{ if .NeedJSON }}"gorm.io/datatypes"{{ end }} ) // {{.Description}} 结构体 {{.StructName}} From dc49f1f8cd1c4f5facbb802b9d7d052042537568 Mon Sep 17 00:00:00 2001 From: SliverHorn Date: Fri, 21 Jun 2024 09:42:55 +0800 Subject: [PATCH 6/6] Update: 1. model.go.tpl import blank line --- .../resource/autocode_template/server/model.go.tpl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/resource/autocode_template/server/model.go.tpl b/server/resource/autocode_template/server/model.go.tpl index ef8799659f..07ca697254 100644 --- a/server/resource/autocode_template/server/model.go.tpl +++ b/server/resource/autocode_template/server/model.go.tpl @@ -2,9 +2,15 @@ package {{.Package}} import ( - {{ if .GvaModel }}"github.com/flipped-aurora/gin-vue-admin/server/global"{{- end }} - {{ if or .HasTimer }}"time"{{ end }} - {{ if .NeedJSON }}"gorm.io/datatypes"{{ end }} + {{- if .GvaModel }} + "github.com/flipped-aurora/gin-vue-admin/server/global" + {{- end }} + {{- if or .HasTimer }} + "time" + {{- end }} + {{- if .NeedJSON }} + "gorm.io/datatypes" + {{- end }} ) // {{.Description}} 结构体 {{.StructName}}