修复部分bug,增加DB SUM函数,以及优化IN性能,增加分析接口
This commit is contained in:
+10
-5
@@ -540,7 +540,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
||||
}
|
||||
sql := flow.GetMap(fk).GetMap("sql")
|
||||
if k == "parent_id" {
|
||||
sql["parent_ids[~]"] = "%," + av.GetString("name") + ",%"
|
||||
sql["parent_ids[~]"] = "," + av.GetString("name") + ","
|
||||
} else {
|
||||
sql[k] = k
|
||||
}
|
||||
@@ -581,7 +581,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
||||
flow[fk] = Map{"table": fk, "stop": false, "sql": Map{}}
|
||||
}
|
||||
sql := flow.GetMap(fk).GetMap("sql")
|
||||
sql["parent_ids[~]"] = "%,id,%"
|
||||
sql["parent_ids[~]"] = ",id,"
|
||||
flow.GetMap(fk)["sql"] = sql
|
||||
}
|
||||
|
||||
@@ -1049,15 +1049,18 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
if len(reqValue) == 0 || reqValue[0] == "" {
|
||||
|
||||
if parent_idsStr != "" && userData[searchItem.GetString("name")] != nil {
|
||||
|
||||
if data[searchItemName] == nil {
|
||||
continue
|
||||
}
|
||||
where := Map{parent_idsStr: "," + ObjToStr(userData.GetCeilInt64(searchItem.GetString("name"))) + ","}
|
||||
r := db.Select(searchItem.GetString("link"), "id", where)
|
||||
reqValue = []string{}
|
||||
for _, v := range r {
|
||||
reqValue = append(reqValue, v.GetString("id"))
|
||||
}
|
||||
if data[searchItemName] != nil {
|
||||
data[searchItemName] = reqValue
|
||||
}
|
||||
|
||||
data[searchItemName] = reqValue
|
||||
|
||||
}
|
||||
|
||||
@@ -1113,7 +1116,9 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
if keywordTableStr == v.GetString("value") {
|
||||
childs := db.Select(v.GetString("link"), "id", Map{v.GetString("value") + "[~]": keywordStr})
|
||||
childIds := Slice{}
|
||||
|
||||
for _, cv := range childs {
|
||||
|
||||
childIds = append(childIds, cv.GetCeilInt64("id"))
|
||||
}
|
||||
if len(childIds) != 0 {
|
||||
|
||||
Reference in New Issue
Block a user