mirror of
https://github.com/astaxie/beego.git
synced 2024-11-29 12:21:27 +00:00
fixed: when RelatedSel have multi string/relation, it only get last string
This commit is contained in:
parent
c4aa33fb1b
commit
6d72fc63ab
@ -115,14 +115,13 @@ func (o querySet) OrderBy(exprs ...string) QuerySeter {
|
||||
// set relation model to query together.
|
||||
// it will query relation models and assign to parent model.
|
||||
func (o querySet) RelatedSel(params ...interface{}) QuerySeter {
|
||||
var related []string
|
||||
if len(params) == 0 {
|
||||
o.relDepth = DefaultRelsDepth
|
||||
} else {
|
||||
for _, p := range params {
|
||||
switch val := p.(type) {
|
||||
case string:
|
||||
related = append(o.related, val)
|
||||
o.related = append(o.related, val)
|
||||
case int:
|
||||
o.relDepth = val
|
||||
default:
|
||||
@ -130,7 +129,6 @@ func (o querySet) RelatedSel(params ...interface{}) QuerySeter {
|
||||
}
|
||||
}
|
||||
}
|
||||
o.related = related
|
||||
return &o
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user