Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b502fed36 | |||
| fd6b15bdaf |
+6
-11
@@ -1016,7 +1016,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
||||
|
||||
if keywordTableStr != "" {
|
||||
if keywordTableStr == v.GetString("name") {
|
||||
keyword[table+"."+keywordTableStr+"[~]"] = keywordStr
|
||||
data[table+"."+keywordTableStr+"[~]"] = keywordStr
|
||||
}
|
||||
|
||||
if keywordTableStr == v.GetString("value") {
|
||||
@@ -1026,7 +1026,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
||||
childIds = append(childIds, cv.GetString("id"))
|
||||
}
|
||||
if len(childIds) != 0 {
|
||||
keyword[v.GetString("link")+".id"] = childIds
|
||||
data[v.GetString("link")+".id"] = childIds
|
||||
}
|
||||
}
|
||||
continue
|
||||
@@ -1143,17 +1143,12 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
|
||||
data[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
if len(keyword) > 1 {
|
||||
|
||||
if data["AND"] != nil {
|
||||
and := data.GetMap("AND")
|
||||
for k, v := range keyword {
|
||||
and[k] = v
|
||||
}
|
||||
|
||||
//data = Map{"AND":Map{"OR": keyword} data, }
|
||||
if data["OR"] != nil {
|
||||
data = Map{"AND": data, "OR": keyword}
|
||||
} else {
|
||||
data["AND"] = keyword
|
||||
data["OR"] = keyword
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+12
-3
@@ -165,8 +165,11 @@ func (that *HotimeDBBuilder) And(qu ...interface{}) *HotimeDBBuilder {
|
||||
}
|
||||
|
||||
if that.lastWhere != nil {
|
||||
if that.lastWhere["AND"] != nil {
|
||||
where["AND"] = that.lastWhere["AND"]
|
||||
}
|
||||
that.lastWhere["AND"] = where
|
||||
that.lastWhere = where
|
||||
//that.lastWhere = where
|
||||
return that
|
||||
}
|
||||
that.lastWhere = where
|
||||
@@ -196,8 +199,11 @@ func (that *HotimeDBBuilder) Or(qu ...interface{}) *HotimeDBBuilder {
|
||||
}
|
||||
|
||||
if that.lastWhere != nil {
|
||||
if that.lastWhere["OR"] != nil {
|
||||
where["OR"] = that.lastWhere["OR"]
|
||||
}
|
||||
that.lastWhere["OR"] = where
|
||||
that.lastWhere = where
|
||||
//that.lastWhere = where
|
||||
return that
|
||||
}
|
||||
that.lastWhere = where
|
||||
@@ -228,8 +234,11 @@ func (that *HotimeDBBuilder) Where(qu ...interface{}) *HotimeDBBuilder {
|
||||
}
|
||||
|
||||
if that.lastWhere != nil {
|
||||
if that.lastWhere["AND"] != nil {
|
||||
where["AND"] = that.lastWhere["AND"]
|
||||
}
|
||||
that.lastWhere["AND"] = where
|
||||
that.lastWhere = where
|
||||
//that.lastWhere = where
|
||||
return that
|
||||
}
|
||||
that.lastWhere = where
|
||||
|
||||
Reference in New Issue
Block a user