修复优化自动代码中对bool类型搜索字段的支持

This commit is contained in:
hansonyu183
2020-06-20 13:01:08 +08:00
parent fe3256175d
commit 937239b7ba
3 changed files with 35 additions and 3 deletions
+7 -2
View File
@@ -7,6 +7,11 @@ import (
// 如果含有time.Time 请自行import time包
type {{.StructName}} struct {
gorm.Model {{range .Fields}}
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:'{{.Comment}}'"`{{ end }}
gorm.Model {{- range .Fields}}
{{- if eq .FieldType "bool" }}
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:'{{.Comment}}'"`
{{- else }}
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:'{{.Comment}}'"`
{{- end }} {{- end }}
}
}