|
|
@ -436,7 +436,7 @@ func GetGoodsList(w *ResponseWriter, r *Request) { |
|
|
|
var total int64 |
|
|
|
var total int64 |
|
|
|
var err error |
|
|
|
var err error |
|
|
|
if err = DB.Scopes(search).Count(&total).Error; err == nil { |
|
|
|
if err = DB.Scopes(search).Count(&total).Error; err == nil { |
|
|
|
err = DB.Scopes(search).Find(&goodsList).Error |
|
|
|
err = DB.Scopes(search).Preload("Creator").Preload("Updater").Find(&goodsList).Error |
|
|
|
} |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
w.Error(err) |
|
|
|
w.Error(err) |
|
|
@ -463,7 +463,7 @@ func GetGoodsPrices(w *ResponseWriter, r *Request) { |
|
|
|
args = append(args, val) |
|
|
|
args = append(args, val) |
|
|
|
} |
|
|
|
} |
|
|
|
if len(queries) == 0 { |
|
|
|
if len(queries) == 0 { |
|
|
|
return db.Preload("Prices") |
|
|
|
return db.Preload("Prices.Creator") |
|
|
|
} |
|
|
|
} |
|
|
|
args = append([]any{strings.Join(queries, " AND ")}, args...) |
|
|
|
args = append([]any{strings.Join(queries, " AND ")}, args...) |
|
|
|
return db.Preload("Prices", args...) |
|
|
|
return db.Preload("Prices", args...) |
|
|
|