forked from golang/hotime
升级流程引擎配置文件版本
This commit is contained in:
parent
78337c14ec
commit
b425024359
@ -555,6 +555,13 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
||||
ta := flow.GetMap(fk)
|
||||
ta["stop"] = true
|
||||
flow[fk] = ta
|
||||
|
||||
if k == "id" && that.TableColumns[fk]["parent_id"] == nil {
|
||||
|
||||
sql := flow.GetMap(fk).GetMap("sql")
|
||||
sql[k] = av.GetString("name")
|
||||
flow.GetMap(fk)["sql"] = sql
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -850,7 +857,7 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
keyword := Map{}
|
||||
daterange := Map{}
|
||||
sortMap := Map{}
|
||||
var ruleData Map
|
||||
//var ruleData Map
|
||||
hasUser := false
|
||||
|
||||
keywordStr := req.FormValue("keyword")
|
||||
@ -920,41 +927,41 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
userData != nil &&
|
||||
that.TableColumns[v.GetString("link")]["parent_id"] != nil {
|
||||
//初始化ruleData
|
||||
if ruleData == nil {
|
||||
ruleData = Map{}
|
||||
for _, v := range that.TableColumns[that.FileConfig.GetString("table")] {
|
||||
if v.GetString("link") != "" &&
|
||||
v.GetString("name") != "parent_id" &&
|
||||
userData.Get(v.GetString("name")) != nil {
|
||||
ruleData[v.GetString("link")] = userData.Get(v.GetString("name"))
|
||||
}
|
||||
}
|
||||
}
|
||||
if ruleData[v.GetString("link")] != nil {
|
||||
parent_idsStr := ""
|
||||
parent_ids := that.TableColumns[v.GetString("link")]["parent_ids"]
|
||||
if parent_ids != nil {
|
||||
parent_idsStr = "parent_ids[~]"
|
||||
}
|
||||
index := that.TableColumns[v.GetString("link")]["index"]
|
||||
if index != nil {
|
||||
parent_idsStr = "index[~]"
|
||||
}
|
||||
|
||||
if v.GetString("name") == "parent_id" {
|
||||
|
||||
data[table+"."+parent_idsStr] = "," + ruleData.GetString(v.GetString("link")) + ","
|
||||
|
||||
} else {
|
||||
idMap := db.Select(v.GetString("link"), "id", Map{parent_idsStr: "," + ruleData.GetString(v.GetString("link")) + ","})
|
||||
ids := Slice{ruleData.GetCeilInt(v.GetString("link"))}
|
||||
for _, v := range idMap {
|
||||
ids = append(ids, v.GetCeilInt("id"))
|
||||
}
|
||||
data[table+"."+v.GetString("name")] = ids
|
||||
}
|
||||
|
||||
}
|
||||
//if ruleData == nil {
|
||||
// ruleData = Map{}
|
||||
// for _, v := range that.TableColumns[that.FileConfig.GetString("table")] {
|
||||
// if v.GetString("link") != "" &&
|
||||
// v.GetString("name") != "parent_id" &&
|
||||
// userData.Get(v.GetString("name")) != nil {
|
||||
// ruleData[v.GetString("link")] = userData.Get(v.GetString("name"))
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//if ruleData[v.GetString("link")] != nil {
|
||||
// parent_idsStr := ""
|
||||
// parent_ids := that.TableColumns[v.GetString("link")]["parent_ids"]
|
||||
// if parent_ids != nil {
|
||||
// parent_idsStr = "parent_ids[~]"
|
||||
// }
|
||||
// index := that.TableColumns[v.GetString("link")]["index"]
|
||||
// if index != nil {
|
||||
// parent_idsStr = "index[~]"
|
||||
// }
|
||||
//
|
||||
// if v.GetString("name") == "parent_id" {
|
||||
//
|
||||
// data[table+"."+parent_idsStr] = "," + ruleData.GetString(v.GetString("link")) + ","
|
||||
//
|
||||
// } else {
|
||||
// idMap := db.Select(v.GetString("link"), "id", Map{parent_idsStr: "," + ruleData.GetString(v.GetString("link")) + ","})
|
||||
// ids := Slice{ruleData.GetCeilInt(v.GetString("link"))}
|
||||
// for _, v := range idMap {
|
||||
// ids = append(ids, v.GetCeilInt("id"))
|
||||
// }
|
||||
// data[table+"."+v.GetString("name")] = ids
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
@ -1005,9 +1012,9 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
for k, _ := range search {
|
||||
searchItem := search.GetMap(k)
|
||||
searchItemName := searchItem.GetString("name")
|
||||
if data[table+"."+searchItemName] != nil {
|
||||
delete(data, table+"."+searchItemName)
|
||||
}
|
||||
//if data[table+"."+searchItemName] != nil {
|
||||
// delete(data, table+"."+searchItemName)
|
||||
//}
|
||||
reqValue := req.Form[searchItemName]
|
||||
parent_idsStr := ""
|
||||
if searchItem.GetString("link") != "" {
|
||||
@ -1031,8 +1038,9 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
||||
for _, v := range r {
|
||||
reqValue = append(reqValue, v.GetString("id"))
|
||||
}
|
||||
|
||||
data[table+"."+searchItemName] = reqValue
|
||||
if data[table+"."+searchItemName] != nil {
|
||||
data[table+"."+searchItemName] = reqValue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user