Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a298cb3d52 | |||
| 68f2c0fd8f | |||
| d314891126 | |||
| c0ae31f499 | |||
| 25edb6b5b7 | |||
| ead64dc776 | |||
| 876e3b1f45 | |||
| d6e940803d |
@@ -218,6 +218,9 @@ var TptProject = Proj{
|
|||||||
}
|
}
|
||||||
inData["parent_ids"] = parent_ids + ObjToStr(re) + ","
|
inData["parent_ids"] = parent_ids + ObjToStr(re) + ","
|
||||||
that.Db.Update(tableName, Map{"parent_ids": inData["parent_ids"]}, Map{"id": re})
|
that.Db.Update(tableName, Map{"parent_ids": inData["parent_ids"]}, Map{"id": re})
|
||||||
|
} else {
|
||||||
|
inData["parent_ids"] = "," + ObjToStr(re) + ","
|
||||||
|
that.Db.Update(tableName, Map{"parent_ids": inData["parent_ids"]}, Map{"id": re})
|
||||||
}
|
}
|
||||||
|
|
||||||
that.Log["table_id"] = re
|
that.Log["table_id"] = re
|
||||||
@@ -365,22 +368,28 @@ var TptProject = Proj{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if inData.Get("parent_id") != nil {
|
if _, ok := inData["parent_id"]; ok {
|
||||||
//1
|
//1
|
||||||
//12 62
|
//12 62
|
||||||
//123 623
|
//123 623
|
||||||
Index := that.Db.Get(tableName, "parent_id,`parent_ids`", Map{"id": that.RouterString[2]})
|
|
||||||
if inData.GetCeilInt64("parent_id") != Index.GetCeilInt64("parent_id") {
|
if inData.GetCeilInt64("parent_id") == 0 {
|
||||||
parentIndex := that.Db.Get(tableName, "`parent_ids`", Map{"id": inData.Get("parent_id")})
|
that.Db.Update(tableName, Map{"parent_ids": "," + that.RouterString[2] + ","}, Map{"id": that.RouterString[2]})
|
||||||
if strings.Contains(parentIndex.GetString("parent_ids"), ","+that.RouterString[2]+",") {
|
} else {
|
||||||
that.Display(4, "不能将子级设置为父级")
|
|
||||||
return
|
Index := that.Db.Get(tableName, "parent_id,`parent_ids`", Map{"id": that.RouterString[2]})
|
||||||
}
|
if inData.GetCeilInt64("parent_id") != Index.GetCeilInt64("parent_id") {
|
||||||
parent_ids := parentIndex.GetString("parent_ids") + that.RouterString[2] + ","
|
parentIndex := that.Db.Get(tableName, "`parent_ids`", Map{"id": inData.Get("parent_id")})
|
||||||
childNodes := that.Db.Select(tableName, "id,`parent_ids`", Map{"parent_ids[~]": "," + that.RouterString[2] + ","})
|
if strings.Contains(parentIndex.GetString("parent_ids"), ","+that.RouterString[2]+",") {
|
||||||
for _, v := range childNodes {
|
that.Display(4, "不能将子级设置为父级")
|
||||||
v["parent_ids"] = strings.Replace(v.GetString("parent_ids"), Index.GetString("parent_ids"), parent_ids, -1)
|
return
|
||||||
that.Db.Update(tableName, Map{"parent_ids": v["parent_ids"]}, Map{"id": v.GetCeilInt("id")})
|
}
|
||||||
|
parent_ids := parentIndex.GetString("parent_ids") + that.RouterString[2] + ","
|
||||||
|
childNodes := that.Db.Select(tableName, "id,`parent_ids`", Map{"parent_ids[~]": "," + that.RouterString[2] + ","})
|
||||||
|
for _, v := range childNodes {
|
||||||
|
v["parent_ids"] = strings.Replace(v.GetString("parent_ids"), Index.GetString("parent_ids"), parent_ids, -1)
|
||||||
|
that.Db.Update(tableName, Map{"parent_ids": v["parent_ids"]}, Map{"id": v.GetCeilInt("id")})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,11 +555,11 @@ var TptProject = Proj{
|
|||||||
|
|
||||||
column := that.MakeCodeRouter[hotimeName].TableColumns[tableName][k]
|
column := that.MakeCodeRouter[hotimeName].TableColumns[tableName][k]
|
||||||
|
|
||||||
if column == nil {
|
if column == nil || column["link"] == nil || !(column["list"] == nil || column["list"] == true) || v.GetCeilInt64(column.GetString("name")) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if (column["list"] == nil || column["list"] == true) && column["name"] == "parent_id" && column.GetString("link") != "" {
|
if column["name"] == "parent_id" {
|
||||||
|
|
||||||
parentC := that.Db.Get(column.GetString("link"), column.GetString("value"), Map{"id": v.GetCeilInt(k)})
|
parentC := that.Db.Get(column.GetString("link"), column.GetString("value"), Map{"id": v.GetCeilInt(k)})
|
||||||
v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = ""
|
v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = ""
|
||||||
@@ -559,8 +568,7 @@ var TptProject = Proj{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if column.GetString("link") != "" &&
|
if column.GetString("name") != "parent_id" {
|
||||||
column.GetString("name") != "parent_id" {
|
|
||||||
reStr := ""
|
reStr := ""
|
||||||
|
|
||||||
if column.GetString("value") == "name" && that.MakeCodeRouter[hotimeName].TableColumns[column.GetString("link")]["nickname"] != nil {
|
if column.GetString("value") == "name" && that.MakeCodeRouter[hotimeName].TableColumns[column.GetString("link")]["nickname"] != nil {
|
||||||
@@ -572,7 +580,7 @@ var TptProject = Proj{
|
|||||||
}
|
}
|
||||||
reStr += column.GetString("value")
|
reStr += column.GetString("value")
|
||||||
|
|
||||||
joinData := that.Db.Get(column.GetString("link"), reStr, Map{"id": v.GetCeilInt(column.GetString("name"))})
|
joinData := that.Db.Get(column.GetString("link"), reStr, Map{"id": v.GetCeilInt64(column.GetString("name"))})
|
||||||
|
|
||||||
if joinData != nil {
|
if joinData != nil {
|
||||||
for kj, vj := range joinData {
|
for kj, vj := range joinData {
|
||||||
|
|||||||
+78
-53
@@ -743,17 +743,23 @@ func (that *MakeCode) Add(table string, user Map, req *http.Request) Map {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reqValue := req.FormValue(v.GetString("name"))
|
if req.Form[v.GetString("name")] == nil {
|
||||||
if (reqValue == "" || reqValue == "null") && strings.Contains(v.GetString("name"), "id") {
|
continue
|
||||||
data[v.GetString("name")] = nil
|
|
||||||
} else {
|
|
||||||
if v.GetString("type") == "password" {
|
|
||||||
data[v.GetString("name")] = Md5(reqValue)
|
|
||||||
} else {
|
|
||||||
data[v.GetString("name")] = reqValue
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reqValue := req.FormValue(v.GetString("name"))
|
||||||
|
if reqValue == "null" {
|
||||||
|
data[v.GetString("name")] = nil
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if v.GetString("type") == "password" {
|
||||||
|
data[v.GetString("name")] = Md5(reqValue)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
data[v.GetString("name")] = reqValue
|
||||||
|
|
||||||
}
|
}
|
||||||
//sn则自动生成
|
//sn则自动生成
|
||||||
if v.GetString("name") == "sn" {
|
if v.GetString("name") == "sn" {
|
||||||
@@ -802,13 +808,21 @@ func (that *MakeCode) Edit(table string, req *http.Request) Map {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if v.Get("edit") == nil || v.GetBool("edit") {
|
if v.Get("edit") == nil || v.GetBool("edit") {
|
||||||
|
|
||||||
if len(req.Form[v.GetString("name")]) == 0 {
|
if len(req.Form[v.GetString("name")]) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
reqValue := req.FormValue(v.GetString("name"))
|
reqValue := req.FormValue(v.GetString("name"))
|
||||||
if reqValue == "null" {
|
if reqValue == "null" {
|
||||||
|
data[v.GetString("name")] = nil
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if v.GetString("type") == "number" && reqValue == "" {
|
||||||
|
data[v.GetString("name")] = nil
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if v.GetString("type") == "password" {
|
if v.GetString("type") == "password" {
|
||||||
data[v.GetString("name")] = Md5(reqValue)
|
data[v.GetString("name")] = Md5(reqValue)
|
||||||
} else {
|
} else {
|
||||||
@@ -907,14 +921,14 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
// hasUser = true
|
// hasUser = true
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// reqValue := req.FormValue(v.GetString("name"))
|
reqValue := req.FormValue(v.GetString("name"))
|
||||||
// if reqValue != "" {
|
if v.GetString("name") != "parent_id" && reqValue != "" {
|
||||||
// data[table+"."+v.GetString("name")] = reqValue
|
data[v.GetString("name")] = reqValue
|
||||||
// }
|
}
|
||||||
//
|
//
|
||||||
//} else {
|
//} else {
|
||||||
|
|
||||||
reStr += table + "." + v.GetString("name") + ","
|
reStr += "`" + v.GetString("name") + "`,"
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//if v["name"] == "parent_id" && v.GetString("link") != "" {
|
//if v["name"] == "parent_id" && v.GetString("link") != "" {
|
||||||
@@ -972,7 +986,7 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
if strings.Contains(v.GetString("type"), "text") {
|
if strings.Contains(v.GetString("type"), "text") {
|
||||||
reqValue := req.FormValue(v.GetString("name"))
|
reqValue := req.FormValue(v.GetString("name"))
|
||||||
if reqValue != "" {
|
if reqValue != "" {
|
||||||
data[table+"."+v.GetString("name")+"[~]"] = reqValue
|
data[v.GetString("name")+"[~]"] = reqValue
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -980,9 +994,9 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
if v.GetString("type") == "unixtime" {
|
if v.GetString("type") == "unixtime" {
|
||||||
|
|
||||||
if len(req.Form[v.GetString("name")]) == 1 {
|
if len(req.Form[v.GetString("name")]) == 1 {
|
||||||
daterange[table+"."+v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
daterange[v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
||||||
} else if len(req.Form[v.GetString("name")]) == 2 {
|
} else if len(req.Form[v.GetString("name")]) == 2 {
|
||||||
daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
daterange[v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
||||||
}
|
}
|
||||||
|
|
||||||
//fmt.Println(req.Form["daterange"])
|
//fmt.Println(req.Form["daterange"])
|
||||||
@@ -995,12 +1009,12 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
if len(req.Form[v.GetString("name")]) == 1 {
|
if len(req.Form[v.GetString("name")]) == 1 {
|
||||||
t := time.Unix(ObjToCeilInt64(req.FormValue(v.GetString("name"))), 0).Format("2006-01-02 15:04:05")
|
t := time.Unix(ObjToCeilInt64(req.FormValue(v.GetString("name"))), 0).Format("2006-01-02 15:04:05")
|
||||||
|
|
||||||
daterange[table+"."+v.GetString("name")+"[>]"] = t
|
daterange[v.GetString("name")+"[>]"] = t
|
||||||
|
|
||||||
} else if len(req.Form[v.GetString("name")]) == 2 {
|
} else if len(req.Form[v.GetString("name")]) == 2 {
|
||||||
t1 := time.Unix(ObjToCeilInt64(req.Form[v.GetString("name")][0]), 0).Format("2006-01-02 15:04:05")
|
t1 := time.Unix(ObjToCeilInt64(req.Form[v.GetString("name")][0]), 0).Format("2006-01-02 15:04:05")
|
||||||
t2 := time.Unix(ObjToCeilInt64(req.Form[v.GetString("name")][1]), 0).Format("2006-01-02 15:04:05")
|
t2 := time.Unix(ObjToCeilInt64(req.Form[v.GetString("name")][1]), 0).Format("2006-01-02 15:04:05")
|
||||||
daterange[table+"."+v.GetString("name")+"[<>]"] = Slice{t1, t2}
|
daterange[v.GetString("name")+"[<>]"] = Slice{t1, t2}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1040,8 +1054,8 @@ 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 {
|
if data[searchItemName] != nil {
|
||||||
data[table+"."+searchItemName] = reqValue
|
data[searchItemName] = reqValue
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1065,10 +1079,10 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
if v.GetString("type") == "unixtime" {
|
if v.GetString("type") == "unixtime" {
|
||||||
//fmt.Println(req.Form["daterange"])
|
//fmt.Println(req.Form["daterange"])
|
||||||
if len(req.Form["daterange"]) == 1 && req.Form["daterange"][0] != "" {
|
if len(req.Form["daterange"]) == 1 && req.Form["daterange"][0] != "" {
|
||||||
daterange[table+"."+v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
daterange[v.GetString("name")+"[>]"] = req.FormValue("daterange")
|
||||||
} else if len(req.Form["daterange"]) == 2 {
|
} else if len(req.Form["daterange"]) == 2 {
|
||||||
|
|
||||||
daterange[table+"."+v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
daterange[v.GetString("name")+"[<>]"] = ObjToSlice(req.Form["daterange"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if v.GetString("type") == "time" {
|
if v.GetString("type") == "time" {
|
||||||
@@ -1077,12 +1091,12 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
if len(req.Form["daterange"]) == 1 && req.Form["daterange"][0] != "" {
|
if len(req.Form["daterange"]) == 1 && req.Form["daterange"][0] != "" {
|
||||||
t := time.Unix(ObjToCeilInt64(req.FormValue("daterange")), 0).Format("2006-01-02 15:04:05")
|
t := time.Unix(ObjToCeilInt64(req.FormValue("daterange")), 0).Format("2006-01-02 15:04:05")
|
||||||
|
|
||||||
daterange[table+"."+v.GetString("name")+"[>]"] = t
|
daterange[v.GetString("name")+"[>]"] = t
|
||||||
|
|
||||||
} else if len(req.Form["daterange"]) == 2 {
|
} else if len(req.Form["daterange"]) == 2 {
|
||||||
t1 := time.Unix(ObjToCeilInt64(req.Form["daterange"][0]), 0).Format("2006-01-02 15:04:05")
|
t1 := time.Unix(ObjToCeilInt64(req.Form["daterange"][0]), 0).Format("2006-01-02 15:04:05")
|
||||||
t2 := time.Unix(ObjToCeilInt64(req.Form["daterange"][1]), 0).Format("2006-01-02 15:04:05")
|
t2 := time.Unix(ObjToCeilInt64(req.Form["daterange"][1]), 0).Format("2006-01-02 15:04:05")
|
||||||
daterange[table+"."+v.GetString("name")+"[<>]"] = Slice{t1, t2}
|
daterange[v.GetString("name")+"[<>]"] = Slice{t1, t2}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1092,38 +1106,38 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
|
|
||||||
if keywordTableStr != "" {
|
if keywordTableStr != "" {
|
||||||
if keywordTableStr == v.GetString("name") {
|
if keywordTableStr == v.GetString("name") {
|
||||||
data[table+"."+keywordTableStr+"[~]"] = keywordStr
|
data[keywordTableStr+"[~]"] = keywordStr
|
||||||
}
|
}
|
||||||
|
|
||||||
if keywordTableStr == v.GetString("value") {
|
if keywordTableStr == v.GetString("value") {
|
||||||
childs := db.Select(v.GetString("link"), "id", Map{v.GetString("value") + "[~]": keywordStr})
|
childs := db.Select(v.GetString("link"), "id", Map{v.GetString("value") + "[~]": keywordStr})
|
||||||
childIds := Slice{}
|
childIds := Slice{}
|
||||||
for _, cv := range childs {
|
for _, cv := range childs {
|
||||||
childIds = append(childIds, cv.GetString("id"))
|
childIds = append(childIds, cv.GetCeilInt64("id"))
|
||||||
}
|
}
|
||||||
if len(childIds) != 0 {
|
if len(childIds) != 0 {
|
||||||
data[v.GetString("link")+".id"] = childIds
|
data[v.GetString("name")] = childIds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(v.GetString("type"), "text") {
|
if strings.Contains(v.GetString("type"), "text") {
|
||||||
keyword[table+"."+v.GetString("name")+"[~]"] = keywordStr
|
keyword[v.GetString("name")+"[~]"] = keywordStr
|
||||||
|
|
||||||
}
|
}
|
||||||
if v.GetString("name") == "id" {
|
if v.GetString("name") == "id" {
|
||||||
keyword[table+"."+v.GetString("name")] = keywordStr
|
keyword[v.GetString("name")] = keywordStr
|
||||||
}
|
}
|
||||||
if v.GetString("link") != "" &&
|
if v.GetString("link") != "" &&
|
||||||
v.GetString("name") != "parent_id" {
|
v.GetString("name") != "parent_id" {
|
||||||
childs := db.Select(v.GetString("link"), "id", Map{v.GetString("value") + "[~]": keywordStr})
|
childs := db.Select(v.GetString("link"), "id", Map{v.GetString("value") + "[~]": keywordStr})
|
||||||
childIds := Slice{}
|
childIds := Slice{}
|
||||||
for _, cv := range childs {
|
for _, cv := range childs {
|
||||||
childIds = append(childIds, cv.GetString("id"))
|
childIds = append(childIds, cv.GetCeilInt64("id"))
|
||||||
}
|
}
|
||||||
if len(childIds) != 0 {
|
if len(childIds) != 0 {
|
||||||
keyword[v.GetString("link")+".id"] = childIds
|
keyword[v.GetString("name")] = childIds
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1132,7 +1146,7 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(reqValue) != 0 && searchItem.GetString("name") == "sort" && reqValue[0] != "" {
|
if len(reqValue) != 0 && searchItem.GetString("name") == "sort" && reqValue[0] != "" {
|
||||||
sortMap["ORDER"] = table + "." + reqValue[0]
|
sortMap["ORDER"] = reqValue[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
@@ -1143,7 +1157,7 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
parentID := ObjToInt(req.FormValue("parent_id"))
|
parentID := ObjToInt(req.FormValue("parent_id"))
|
||||||
if parentID == 0 {
|
if parentID == 0 {
|
||||||
parentID = userData.GetCeilInt(table + "_id")
|
parentID = userData.GetCeilInt(table + "_id")
|
||||||
data["OR"] = Map{table + ".id": parentID, table + ".parent_id": nil}
|
data["OR"] = Map{"id": parentID, "parent_id": nil}
|
||||||
} else {
|
} else {
|
||||||
//是否展示全部子级
|
//是否展示全部子级
|
||||||
where := Map{}
|
where := Map{}
|
||||||
@@ -1151,21 +1165,21 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
|
|
||||||
for _, v := range reqValue {
|
for _, v := range reqValue {
|
||||||
if len(where) == 0 {
|
if len(where) == 0 {
|
||||||
where[table+"."+parent_idsStr] = "," + v + ","
|
where[parent_idsStr] = "," + v + ","
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
where = Map{"OR": where, table + "." + parent_idsStr: "," + v + ","}
|
where = Map{"OR": where, parent_idsStr: "," + v + ","}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
where[table+".parent_id"] = reqValue
|
where["parent_id"] = reqValue
|
||||||
}
|
}
|
||||||
//是否展示自己
|
//是否展示自己
|
||||||
if req.FormValue("showself") == "1" {
|
if req.FormValue("showself") == "1" {
|
||||||
if len(where) == 0 {
|
if len(where) == 0 {
|
||||||
data["OR"] = Map{table + ".id": reqValue}
|
data["OR"] = Map{"id": reqValue}
|
||||||
} else {
|
} else {
|
||||||
data["OR"] = Map{"OR": where, table + ".id": reqValue}
|
data["OR"] = Map{"OR": where, "id": reqValue}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if len(where) != 0 {
|
if len(where) != 0 {
|
||||||
@@ -1181,26 +1195,37 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
|
|
||||||
if parent_idsStr != "" {
|
if parent_idsStr != "" {
|
||||||
|
|
||||||
where := Map{}
|
//where := Map{}
|
||||||
//是否全部展示
|
//是否全部展示
|
||||||
if req.FormValue("showall") != "1" {
|
if req.FormValue("showall") != "1" {
|
||||||
where[table+"."+searchItem.GetString("name")] = reqValue
|
if len(reqValue) != 0 {
|
||||||
|
data[searchItem.GetString("name")] = reqValue
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
ls := []int64{}
|
||||||
for _, v := range reqValue {
|
for _, v := range reqValue {
|
||||||
if len(where) == 0 {
|
|
||||||
where[searchItem.GetString("link")+"."+parent_idsStr] = "," + v + ","
|
ls1 := db.Select(searchItem.GetString("link"), "id", Map{"OR": Map{parent_idsStr: "," + v + ",", "id": v}})
|
||||||
continue
|
for _, vls1 := range ls1 {
|
||||||
|
ls = append(ls, vls1.GetCeilInt64("id"))
|
||||||
}
|
}
|
||||||
where = Map{"OR": where, searchItem.GetString("link") + "." + parent_idsStr: "," + v + ","}
|
}
|
||||||
|
|
||||||
|
if len(ls) != 0 {
|
||||||
|
data[searchItem.GetString("name")] = ls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//用户
|
//用户
|
||||||
if userData[searchItem.GetString("name")] != nil {
|
//if userData[searchItem.GetString("name")] != nil {
|
||||||
|
//
|
||||||
where = Map{"AND": Map{searchItem.GetString("link") + "." + parent_idsStr: "," + ObjToStr(userData.GetCeilInt64(searchItem.GetString("name"))) + ",", "OR": where}}
|
// where = Map{"AND": Map{searchItem.GetString("link") + "." + parent_idsStr: "," + ObjToStr(userData.GetCeilInt64(searchItem.GetString("name"))) + ",", "OR": where}}
|
||||||
}
|
//}
|
||||||
data["OR"] = where
|
//if len(where)!=0{
|
||||||
|
// data["OR"] = where
|
||||||
|
//}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
//r := db.Select(searchItem.GetString("link"), "id", where)
|
//r := db.Select(searchItem.GetString("link"), "id", where)
|
||||||
@@ -1212,13 +1237,13 @@ func (that *MakeCode) Search(table string, userData Map, data Map, req *http.Req
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(reqValue) != 0 && reqValue[0] != "" {
|
if len(reqValue) != 0 && reqValue[0] != "" {
|
||||||
data[table+"."+searchItemName] = reqValue
|
data[searchItemName] = reqValue
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if sortMap["ORDER"] == nil {
|
if sortMap["ORDER"] == nil {
|
||||||
sortMap["ORDER"] = table + ".id DESC"
|
sortMap["ORDER"] = "id DESC"
|
||||||
}
|
}
|
||||||
|
|
||||||
where := Map{}
|
where := Map{}
|
||||||
|
|||||||
@@ -0,0 +1,472 @@
|
|||||||
|
{
|
||||||
|
"flow": {
|
||||||
|
"admin": {
|
||||||
|
"sql": {
|
||||||
|
"role_id": "role_id"
|
||||||
|
},
|
||||||
|
"stop": false,
|
||||||
|
"table": "admin"
|
||||||
|
},
|
||||||
|
"article": {
|
||||||
|
"sql": {
|
||||||
|
"admin_id": "id"
|
||||||
|
},
|
||||||
|
"stop": false,
|
||||||
|
"table": "article"
|
||||||
|
},
|
||||||
|
"ctg": {
|
||||||
|
"sql": {
|
||||||
|
"admin_id": "id"
|
||||||
|
},
|
||||||
|
"stop": false,
|
||||||
|
"table": "ctg"
|
||||||
|
},
|
||||||
|
"ctg_article": {
|
||||||
|
"sql": {
|
||||||
|
"admin_id": "id"
|
||||||
|
},
|
||||||
|
"stop": false,
|
||||||
|
"table": "ctg_article"
|
||||||
|
},
|
||||||
|
"ctg_copy": {
|
||||||
|
"sql": {
|
||||||
|
"admin_id": "id"
|
||||||
|
},
|
||||||
|
"stop": false,
|
||||||
|
"table": "ctg_copy"
|
||||||
|
},
|
||||||
|
"logs": {
|
||||||
|
"sql": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"stop": false,
|
||||||
|
"table": "logs"
|
||||||
|
},
|
||||||
|
"org": {
|
||||||
|
"sql": {
|
||||||
|
"admin_id": "id"
|
||||||
|
},
|
||||||
|
"stop": false,
|
||||||
|
"table": "org"
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"sql": {
|
||||||
|
"admin_id": "id",
|
||||||
|
"id": "role_id"
|
||||||
|
},
|
||||||
|
"stop": true,
|
||||||
|
"table": "role"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"id": "74a8a59407fa7d6c7fcdc85742dbae57",
|
||||||
|
"label": "HoTime管理平台",
|
||||||
|
"labelConfig": {
|
||||||
|
"add": "添加",
|
||||||
|
"delete": "删除",
|
||||||
|
"download": "下载清单",
|
||||||
|
"edit": "编辑",
|
||||||
|
"info": "查看详情",
|
||||||
|
"show": "开启"
|
||||||
|
},
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show"
|
||||||
|
],
|
||||||
|
"icon": "Setting",
|
||||||
|
"label": "ebw_news",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_news",
|
||||||
|
"table": "ebw_news"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_news_addition_res",
|
||||||
|
"table": "ebw_news_addition_res"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_annex",
|
||||||
|
"table": "ebw_annex"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_customer",
|
||||||
|
"table": "ebw_customer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_items",
|
||||||
|
"table": "ebw_items"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_res",
|
||||||
|
"table": "ebw_res"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_vote",
|
||||||
|
"table": "ebw_vote"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_vote_option",
|
||||||
|
"table": "ebw_vote_option"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_user",
|
||||||
|
"table": "ebw_user"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_attachment",
|
||||||
|
"table": "ebw_attachment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_jobs",
|
||||||
|
"table": "ebw_jobs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "ebw_vote_user",
|
||||||
|
"table": "ebw_vote_user"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "sys:ebw"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show"
|
||||||
|
],
|
||||||
|
"icon": "Setting",
|
||||||
|
"label": "系统管理",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "日志管理",
|
||||||
|
"table": "logs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "角色管理",
|
||||||
|
"table": "role"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "组织管理",
|
||||||
|
"table": "org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "人员管理",
|
||||||
|
"table": "admin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "文章管理",
|
||||||
|
"table": "article"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "sys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show"
|
||||||
|
],
|
||||||
|
"icon": "Setting",
|
||||||
|
"label": "外部系统",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "外部系统",
|
||||||
|
"table": "swiper_sys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "顶部",
|
||||||
|
"table": "swiper_top"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "飘窗",
|
||||||
|
"table": "swiper_fly"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "底部",
|
||||||
|
"table": "swiper_bottom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "中间",
|
||||||
|
"table": "swiper_center"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "关联专题",
|
||||||
|
"table": "swiper_point"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "sys:swiper"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show"
|
||||||
|
],
|
||||||
|
"icon": "Setting",
|
||||||
|
"label": "栏目管理",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "栏目管理",
|
||||||
|
"table": "ctg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "关联栏目",
|
||||||
|
"table": "ctg_article"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "栏目管理",
|
||||||
|
"table": "ctg_copy"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "sys:ctg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show"
|
||||||
|
],
|
||||||
|
"icon": "Setting",
|
||||||
|
"label": "纪委信箱",
|
||||||
|
"menus": [
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "纪委信箱",
|
||||||
|
"table": "mail_discipline"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "总经理信箱",
|
||||||
|
"table": "mail"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"auth": [
|
||||||
|
"show",
|
||||||
|
"add",
|
||||||
|
"delete",
|
||||||
|
"edit",
|
||||||
|
"info",
|
||||||
|
"download"
|
||||||
|
],
|
||||||
|
"label": "党委书记信箱",
|
||||||
|
"table": "mail_part"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "sys:mail"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "admin",
|
||||||
|
"stop": [
|
||||||
|
"role",
|
||||||
|
"org"
|
||||||
|
]
|
||||||
|
}
|
||||||
+350
-347
File diff suppressed because it is too large
Load Diff
@@ -396,7 +396,7 @@
|
|||||||
"list": false,
|
"list": false,
|
||||||
"must": false,
|
"must": false,
|
||||||
"name": "auth",
|
"name": "auth",
|
||||||
"strict": false,
|
"strict": true,
|
||||||
"type": "auth"
|
"type": "auth"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user