diff --git a/data/view/genfunc/def.go b/data/view/genfunc/def.go index eb02659..aa98fa3 100644 --- a/data/view/genfunc/def.go +++ b/data/view/genfunc/def.go @@ -189,12 +189,12 @@ func (obj *_{{$obj.StructName}}Mgr) GetBatchFrom{{$oem.ColStructName}}({{CapLowe ` genPreload = `if err == nil && obj.isRelated { {{range $obj := .}}{{if $obj.IsMulti}} if err = obj.DB.New().Table("{{$obj.ForeignkeyTableName}}").Where("{{$obj.ForeignkeyCol}} = ?", result.{{$obj.ColStructName}}).Find(&result.{{$obj.ForeignkeyStructName}}List).Error;err != nil { // {{$obj.Notes}} - if err != gorm.ErrRecordNotFound { // 没找到 + if err != gorm.ErrRecordNotFound { // 非 没找到 return } } {{else}} if err = obj.DB.New().Table("{{$obj.ForeignkeyTableName}}").Where("{{$obj.ForeignkeyCol}} = ?", result.{{$obj.ColStructName}}).Find(&result.{{$obj.ForeignkeyStructName}}).Error; err != nil { // {{$obj.Notes}} - if err != gorm.ErrRecordNotFound { // 没找到 + if err != gorm.ErrRecordNotFound { // 非 没找到 return } }{{end}} {{end}}} @@ -202,12 +202,12 @@ func (obj *_{{$obj.StructName}}Mgr) GetBatchFrom{{$oem.ColStructName}}({{CapLowe genPreloadMulti = `if err == nil && obj.isRelated { for i := 0; i < len(results); i++ { {{range $obj := .}}{{if $obj.IsMulti}} if err = obj.DB.New().Table("{{$obj.ForeignkeyTableName}}").Where("{{$obj.ForeignkeyCol}} = ?", results[i].{{$obj.ColStructName}}).Find(&results[i].{{$obj.ForeignkeyStructName}}List).Error;err != nil { // {{$obj.Notes}} - if err != gorm.ErrRecordNotFound { // 没找到 + if err != gorm.ErrRecordNotFound { // 非 没找到 return } } {{else}} if err = obj.DB.New().Table("{{$obj.ForeignkeyTableName}}").Where("{{$obj.ForeignkeyCol}} = ?", results[i].{{$obj.ColStructName}}).Find(&results[i].{{$obj.ForeignkeyStructName}}).Error; err != nil { // {{$obj.Notes}} - if err != gorm.ErrRecordNotFound { // 没找到 + if err != gorm.ErrRecordNotFound { // 非 没找到 return } } {{end}} {{end}}