数据库错误操作优化

This commit is contained in:
hoteas
2022-08-25 05:01:50 +08:00
parent 340a90278b
commit c959402250
2 changed files with 49 additions and 44 deletions
+18 -14
View File
@@ -725,9 +725,9 @@ func (that *MakeCode) Edit(table string, req *http.Request) Map {
for _, v := range that.TableColumns[table] {
//不可使用,未在前端展示,但在内存中保持有
if v.GetBool("notUse") {
if v.GetString("type") == "index" && that.TableColumns[table]["parent_id"] != nil {
data[v.GetString("name")] = ","
}
//if v.GetString("type") == "index" && that.TableColumns[table]["parent_id"] != nil {
// data[v.GetString("name")] = ","
//}
continue
}
@@ -764,16 +764,16 @@ func (that *MakeCode) Edit(table string, req *http.Request) Map {
}
func (that *MakeCode) Delete(table string, req *http.Request) Map {
data := Map{}
for _, v := range that.TableColumns[table] {
//不可使用,未在前端展示,但在内存中保持有
if v.GetBool("notUse") {
if v.GetString("type") == "index" && that.TableColumns[table]["parent_id"] != nil {
data[v.GetString("name")] = ","
}
continue
}
}
//for _, v := range that.TableColumns[table] {
// //不可使用,未在前端展示,但在内存中保持有
// if v.GetBool("notUse") {
// //if v.GetString("type") == "index" && that.TableColumns[table]["parent_id"] != nil {
// // data[v.GetString("name")] = ","
// //}
// continue
// }
//
//}
return data
}
@@ -1064,7 +1064,11 @@ func (that *MakeCode) Search(table string, userData Map, req *http.Request, db *
data["OR"] = Map{table + ".id": parentID, table + ".parent_id": nil}
} else {
data["OR"] = Map{table + ".parent_id": reqValue, table + ".id": reqValue}
if req.FormValue("showself") != "" {
data["OR"] = Map{table + ".parent_id": reqValue, table + ".id": reqValue}
} else {
data[table+".parent_id"] = reqValue
}
}
continue