diff --git a/code/makecode.go b/code/makecode.go index 239029b..855a292 100644 --- a/code/makecode.go +++ b/code/makecode.go @@ -625,18 +625,18 @@ func (that *MakeCode) Search(table string, req *http.Request, db *db.HoTimeDB) ( continue } + //树节点模式搜索 + if searchItemName == "parent_id" { + parentID := ObjToInt(req.FormValue("parent_id")) + if parentID == 0 { + data["OR"] = Map{table + ".parent_id[#]": 0, table + ".parent_id": nil} + } else { + data[table+".parent_id"] = parentID + } + continue + } data[table+"."+searchItemName] = reqValue - } - - //树节点模式搜索 - if req.Form["parent_id"] != nil { - parentID := ObjToInt(req.FormValue("parent_id")) - if parentID == 0 { - data["OR"] = Map{table + ".parent_id[#]": 0, table + ".parent_id": nil} - } else { - data[table+".parent_id"] = parentID - } }