修复优化自动代码中对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
+1 -1
View File
@@ -71,7 +71,7 @@ func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error,
db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+ {{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
}
{{- else if eq .FieldType "bool" }}
if info.{{.FieldName}} != 0 {
if info.{{.FieldName}} != nil {
db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
}
{{- else if eq .FieldType "int" }}