From efb6cb980e5a6eee9c8b18af7e02072a623d05d5 Mon Sep 17 00:00:00 2001 From: hoteas <925970985@qq.com> Date: Fri, 18 Jun 2021 04:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/makecode.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 - } }