增加两个参数

This commit is contained in:
hoteas
2022-09-16 07:10:45 +08:00
parent 22a1f19e6a
commit 9ac5abe884
2 changed files with 58 additions and 12 deletions
+21 -12
View File
@@ -1069,9 +1069,10 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
parentID = userData.GetCeilInt(table + "_id")
data["OR"] = Map{table + ".id": parentID, table + ".parent_id": nil}
} else {
//是否展示全部子级
where := Map{}
if req.FormValue("showall") == "1" {
if req.FormValue("showself") != "" {
where := Map{}
for _, v := range reqValue {
if len(where) == 0 {
where[table+"."+parent_idsStr] = "," + v + ","
@@ -1079,9 +1080,21 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
}
where = Map{"OR": where, table + "." + parent_idsStr: "," + v + ","}
}
data["OR"] = Map{"OR": where, table + ".id": reqValue}
} else {
data[table+".parent_id"] = reqValue
where[table+".parent_id"] = reqValue
}
//是否展示自己
if req.FormValue("showself") == "1" {
if len(where) == 0 {
data["OR"] = Map{table + ".id": reqValue}
} else {
data["OR"] = Map{"OR": where, table + ".id": reqValue}
}
} else {
if len(where) != 0 {
data["OR"] = where
}
}
}
@@ -1093,14 +1106,9 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
if parent_idsStr != "" {
where := Map{}
if len(reqValue) == 1 {
if len(where) == 0 {
where[table+"."+searchItem.GetString("name")] = reqValue[0]
} else {
where = Map{"OR": where, table + "." + searchItem.GetString("name"): reqValue[0]}
}
//是否全部展示
if req.FormValue("showall") != "1" {
where[table+"."+searchItem.GetString("name")] = reqValue
} else {
for _, v := range reqValue {
if len(where) == 0 {
@@ -1110,6 +1118,7 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
where = Map{"OR": where, searchItem.GetString("link") + "." + parent_idsStr: "," + v + ","}
}
}
//用户
if userData[searchItem.GetString("name")] != nil {