升级流程引擎配置文件版本

This commit is contained in:
hoteas 2022-10-20 09:00:44 +08:00
parent 78337c14ec
commit b425024359
2 changed files with 632 additions and 622 deletions

View File

@ -555,6 +555,13 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
ta := flow.GetMap(fk) ta := flow.GetMap(fk)
ta["stop"] = true ta["stop"] = true
flow[fk] = ta 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{} keyword := Map{}
daterange := Map{} daterange := Map{}
sortMap := Map{} sortMap := Map{}
var ruleData Map //var ruleData Map
hasUser := false hasUser := false
keywordStr := req.FormValue("keyword") keywordStr := req.FormValue("keyword")
@ -920,41 +927,41 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
userData != nil && userData != nil &&
that.TableColumns[v.GetString("link")]["parent_id"] != nil { that.TableColumns[v.GetString("link")]["parent_id"] != nil {
//初始化ruleData //初始化ruleData
if ruleData == nil { //if ruleData == nil {
ruleData = Map{} // ruleData = Map{}
for _, v := range that.TableColumns[that.FileConfig.GetString("table")] { // for _, v := range that.TableColumns[that.FileConfig.GetString("table")] {
if v.GetString("link") != "" && // if v.GetString("link") != "" &&
v.GetString("name") != "parent_id" && // v.GetString("name") != "parent_id" &&
userData.Get(v.GetString("name")) != nil { // userData.Get(v.GetString("name")) != nil {
ruleData[v.GetString("link")] = userData.Get(v.GetString("name")) // ruleData[v.GetString("link")] = userData.Get(v.GetString("name"))
} // }
} // }
} //}
if ruleData[v.GetString("link")] != nil { //if ruleData[v.GetString("link")] != nil {
parent_idsStr := "" // parent_idsStr := ""
parent_ids := that.TableColumns[v.GetString("link")]["parent_ids"] // parent_ids := that.TableColumns[v.GetString("link")]["parent_ids"]
if parent_ids != nil { // if parent_ids != nil {
parent_idsStr = "parent_ids[~]" // parent_idsStr = "parent_ids[~]"
} // }
index := that.TableColumns[v.GetString("link")]["index"] // index := that.TableColumns[v.GetString("link")]["index"]
if index != nil { // if index != nil {
parent_idsStr = "index[~]" // parent_idsStr = "index[~]"
} // }
//
if v.GetString("name") == "parent_id" { // if v.GetString("name") == "parent_id" {
//
data[table+"."+parent_idsStr] = "," + ruleData.GetString(v.GetString("link")) + "," // data[table+"."+parent_idsStr] = "," + ruleData.GetString(v.GetString("link")) + ","
//
} else { // } else {
idMap := db.Select(v.GetString("link"), "id", Map{parent_idsStr: "," + ruleData.GetString(v.GetString("link")) + ","}) // idMap := db.Select(v.GetString("link"), "id", Map{parent_idsStr: "," + ruleData.GetString(v.GetString("link")) + ","})
ids := Slice{ruleData.GetCeilInt(v.GetString("link"))} // ids := Slice{ruleData.GetCeilInt(v.GetString("link"))}
for _, v := range idMap { // for _, v := range idMap {
ids = append(ids, v.GetCeilInt("id")) // ids = append(ids, v.GetCeilInt("id"))
} // }
data[table+"."+v.GetString("name")] = ids // 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 { for k, _ := range search {
searchItem := search.GetMap(k) searchItem := search.GetMap(k)
searchItemName := searchItem.GetString("name") searchItemName := searchItem.GetString("name")
if data[table+"."+searchItemName] != nil { //if data[table+"."+searchItemName] != nil {
delete(data, table+"."+searchItemName) // delete(data, table+"."+searchItemName)
} //}
reqValue := req.Form[searchItemName] reqValue := req.Form[searchItemName]
parent_idsStr := "" parent_idsStr := ""
if searchItem.GetString("link") != "" { 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 { for _, v := range r {
reqValue = append(reqValue, v.GetString("id")) reqValue = append(reqValue, v.GetString("id"))
} }
if data[table+"."+searchItemName] != nil {
data[table+"."+searchItemName] = reqValue data[table+"."+searchItemName] = reqValue
}
} }

File diff suppressed because it is too large Load Diff