mirror of
https://github.com/beego/bee.git
synced 2024-11-26 16:41:30 +00:00
得到外键对象。
This commit is contained in:
parent
f453885864
commit
a294cf5517
@ -1080,7 +1080,7 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
|
||||
}
|
||||
sortFields = append(sortFields, orderby)
|
||||
}
|
||||
qs = qs.OrderBy(sortFields...)
|
||||
qs = qs.OrderBy(sortFields...).RelatedSel()
|
||||
} else if len(sortby) != len(order) && len(order) == 1 {
|
||||
// 2) there is exactly one order, all the sorted fields will be sorted by this order
|
||||
for _, v := range sortby {
|
||||
@ -1104,7 +1104,7 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
|
||||
}
|
||||
|
||||
var l []{{modelName}}
|
||||
qs = qs.OrderBy(sortFields...)
|
||||
qs = qs.OrderBy(sortFields...).RelatedSel()
|
||||
if _, err = qs.Limit(limit, offset).All(&l, fields...); err == nil {
|
||||
if len(fields) == 0 {
|
||||
for _, v := range l {
|
||||
|
@ -238,7 +238,7 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
|
||||
}
|
||||
sortFields = append(sortFields, orderby)
|
||||
}
|
||||
qs = qs.OrderBy(sortFields...)
|
||||
qs = qs.OrderBy(sortFields...).RelatedSel()
|
||||
} else if len(sortby) != len(order) && len(order) == 1 {
|
||||
// 2) there is exactly one order, all the sorted fields will be sorted by this order
|
||||
for _, v := range sortby {
|
||||
@ -262,7 +262,7 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
|
||||
}
|
||||
|
||||
var l []{{modelName}}
|
||||
qs = qs.OrderBy(sortFields...)
|
||||
qs = qs.OrderBy(sortFields...).RelatedSel()
|
||||
if _, err = qs.Limit(limit, offset).All(&l, fields...); err == nil {
|
||||
if len(fields) == 0 {
|
||||
for _, v := range l {
|
||||
|
@ -200,7 +200,7 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
|
||||
}
|
||||
sortFields = append(sortFields, orderby)
|
||||
}
|
||||
qs = qs.OrderBy(sortFields...)
|
||||
qs = qs.OrderBy(sortFields...).RelatedSel()
|
||||
} else if len(sortby) != len(order) && len(order) == 1 {
|
||||
// 2) there is exactly one order, all the sorted fields will be sorted by this order
|
||||
for _, v := range sortby {
|
||||
@ -224,7 +224,7 @@ func GetAll{{modelName}}(query map[string]string, fields []string, sortby []stri
|
||||
}
|
||||
|
||||
var l []{{modelName}}
|
||||
qs = qs.OrderBy(sortFields...)
|
||||
qs = qs.OrderBy(sortFields...).RelatedSel()
|
||||
if _, err = qs.Limit(limit, offset).All(&l, fields...); err == nil {
|
||||
if len(fields) == 0 {
|
||||
for _, v := range l {
|
||||
|
Loading…
Reference in New Issue
Block a user