diff --git a/example/admin/admin.go b/example/admin/admin.go new file mode 100644 index 0000000..329beb2 --- /dev/null +++ b/example/admin/admin.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var adminCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/category.go b/example/admin/category.go new file mode 100644 index 0000000..f49c8c7 --- /dev/null +++ b/example/admin/category.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var categoryCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/furnace_temperature.go b/example/admin/furnace_temperature.go new file mode 100644 index 0000000..df55a54 --- /dev/null +++ b/example/admin/furnace_temperature.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var furnace_temperatureCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/init.go b/example/admin/init.go new file mode 100644 index 0000000..76f017e --- /dev/null +++ b/example/admin/init.go @@ -0,0 +1,78 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" +) + +var ID = "60556aa6be624432476d17b588fa237c" + +// Project 管理端项目 +var Project = Proj{ + //"user": UserCtr, + "admin": adminCtr, + "category": categoryCtr, + "furnace_temperature": furnace_temperatureCtr, + "material": materialCtr, + "material_inout": material_inoutCtr, + "org": orgCtr, + "produce": produceCtr, + "produce_material": produce_materialCtr, + "product": productCtr, + "product_check": product_checkCtr, + "product_spot_check": product_spot_checkCtr, + "role": roleCtr, + "user": userCtr, + + "hotime": Ctr{ + "login": func(this *Context) { + name := this.Req.FormValue("name") + password := this.Req.FormValue("password") + if name == "" || password == "" { + this.Display(3, "参数不足") + return + } + user := this.Db.Get("admin", "*", Map{"AND": Map{"OR": Map{"name": name, "phone": name}, "password": Md5(password)}}) + if user == nil { + this.Display(5, "登录失败") + return + } + this.Session("admin_id", user.GetCeilInt("id")) + this.Session("admin_name", name) + this.Display(0, this.SessionId) + }, + "logout": func(this *Context) { + this.Session("admin_id", nil) + this.Session("admin_name", nil) + this.Display(0, "退出登录成功") + }, + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info("admin", data, that.Db) + where := Map{"id": that.Session("admin_id").ToCeilInt()} + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + re := that.Db.Get("admin", str, where) + if re == nil { + that.Display(4, "找不到对应信息") + return + } + for k, v := range re { + column := that.MakeCode.TableColumns["admin"][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + }, +} diff --git a/example/admin/material.go b/example/admin/material.go new file mode 100644 index 0000000..3922552 --- /dev/null +++ b/example/admin/material.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var materialCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/material_inout.go b/example/admin/material_inout.go new file mode 100644 index 0000000..9384631 --- /dev/null +++ b/example/admin/material_inout.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var material_inoutCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/org.go b/example/admin/org.go new file mode 100644 index 0000000..6da7efa --- /dev/null +++ b/example/admin/org.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var orgCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/produce.go b/example/admin/produce.go new file mode 100644 index 0000000..0de8a85 --- /dev/null +++ b/example/admin/produce.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var produceCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/produce_material.go b/example/admin/produce_material.go new file mode 100644 index 0000000..724859d --- /dev/null +++ b/example/admin/produce_material.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var produce_materialCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/product.go b/example/admin/product.go new file mode 100644 index 0000000..a44bb94 --- /dev/null +++ b/example/admin/product.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var productCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/product_check.go b/example/admin/product_check.go new file mode 100644 index 0000000..0e08da2 --- /dev/null +++ b/example/admin/product_check.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var product_checkCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/product_spot_check.go b/example/admin/product_spot_check.go new file mode 100644 index 0000000..785b169 --- /dev/null +++ b/example/admin/product_spot_check.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var product_spot_checkCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/role.go b/example/admin/role.go new file mode 100644 index 0000000..d29d786 --- /dev/null +++ b/example/admin/role.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var roleCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/admin/user.go b/example/admin/user.go new file mode 100644 index 0000000..12cbdf0 --- /dev/null +++ b/example/admin/user.go @@ -0,0 +1,160 @@ +package admin + +import ( + . "../../../hotime" + . "../../../hotime/common" + "strings" +) + +var userCtr = Ctr{ + "info": func(that *Context) { + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db) + where := Map{"id": that.RouterString[2]} + + if len(inData) == 1 { + inData["id"] = where["id"] + where = Map{"AND": inData} + } else if len(inData) > 1 { + where["OR"] = inData + where = Map{"AND": where} + } + + re := that.Db.Get(that.RouterString[1], str, where) + + if re == nil { + that.Display(4, "找不到对应信息") + return + } + + for k, v := range re { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { + re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v}) + } + } + + that.Display(0, re) + }, + "add": func(that *Context) { + inData := that.MakeCode.Add(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + + re := that.Db.Insert(that.RouterString[1], inData) + + if re == 0 { + that.Display(4, "无法插入对应数据") + return + } + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = index.GetString("index") + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } else if inData.GetString("index") != "" { + inData["index"] = "," + ObjToStr(re) + "," + that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re}) + } + + that.Display(0, re) + }, + "update": func(that *Context) { + inData := that.MakeCode.Edit(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "没有找到要更新的数据") + return + } + + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetString("index") != "" { + Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) + parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) + inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," + + childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","}) + + for _, v := range childNodes { + v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) + that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) + } + + } + + re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]}) + + if re == 0 { + that.Display(4, "更新数据失败") + return + } + + that.Display(0, re) + }, + "remove": func(that *Context) { + inData := that.MakeCode.Delete(that.RouterString[1], that.Req) + if inData == nil { + that.Display(3, "请求参数不足") + return + } + re := int64(0) + //索引管理,便于检索以及权限 + if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil { + re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","}) + } else { + re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]}) + } + + if re == 0 { + that.Display(4, "删除数据失败") + return + } + that.Display(0, "删除成功") + }, + + "search": func(that *Context) { + + data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()}) + + columnStr, leftJoin, where := that.MakeCode.Search(that.RouterString[1], data, that.Req, that.Db) + + page := ObjToInt(that.Req.FormValue("page")) + pageSize := ObjToInt(that.Req.FormValue("pageSize")) + + if page < 1 { + page = 1 + } + + if pageSize <= 0 { + pageSize = 20 + } + + count := that.Db.Count(that.RouterString[1], leftJoin, where) + reData := that.Db.Page(page, pageSize). + PageSelect(that.RouterString[1], leftJoin, columnStr, where) + + for _, v := range reData { + for k, _ := range v { + column := that.MakeCode.TableColumns[that.RouterString[1]][k] + if column == nil { + continue + } + + if column["list"] != false && column["name"] == "parent_id" && column.GetString("link") != "" { + 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")] = "" + if parentC != nil { + v[column.GetString("link")+"_"+column.GetString("name")+"_"+column.GetString("value")] = parentC.GetString(column.GetString("value")) + } + } + + } + } + + that.Display(0, Map{"count": count, "data": reData}) + }, +} diff --git a/example/config/app.json b/example/config/app.json new file mode 100644 index 0000000..1c23d18 --- /dev/null +++ b/example/config/app.json @@ -0,0 +1,2013 @@ +{ + "id": "60556aa6be624432476d17b588fa237c", + "label": "HoTime管理平台", + "menus": [ + { + "icon": "el-icon-s-home", + "label": "平台首页", + "name": "HelloWorld" + }, + { + "icon": "el-icon-setting", + "label": "系统管理", + "menus": [ + { + "label": "关联原材料", + "table": "produce_material" + }, + { + "label": "成品管理", + "table": "product" + }, + { + "label": "人员管理", + "table": "admin" + }, + { + "label": "事项管理", + "table": "category" + }, + { + "label": "炉温监控", + "table": "furnace_temperature" + }, + { + "label": "部门管理", + "table": "org" + }, + { + "label": "生产计划", + "table": "produce" + }, + { + "label": "原材料管理", + "table": "material" + }, + { + "label": "出入库管理", + "table": "material_inout" + }, + { + "label": "角色管理", + "table": "role" + }, + { + "label": "客户管理", + "table": "user" + } + ], + "name": "sys" + }, + { + "icon": "el-icon-setting", + "label": "抽检管理", + "menus": [ + { + "label": "抽检管理", + "table": "product_spot_check" + }, + { + "label": "质检管理", + "table": "product_check" + } + ], + "name": "product" + } + ], + "name": "admin", + "tables": { + "admin": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "名称", + "name": "name", + "type": "text" + }, + { + "label": "手机号", + "name": "phone", + "type": "text" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + } + ], + "type": "select" + }, + { + "info": false, + "label": "密码", + "list": false, + "must": false, + "name": "password", + "type": "password" + }, + { + "label": "头像", + "list": false, + "must": false, + "name": "avatar_img", + "type": "image" + }, + { + "label": "角色", + "link": "role", + "name": "role_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "部门", + "link": "org", + "name": "org_id", + "sortable": true, + "type": "number", + "value": "name" + } + ], + "label": "人员管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + }, + { + "label": "部门", + "link": "org", + "name": "org_id", + "type": "tree", + "value": "name" + } + ], + "table": "admin" + }, + "category": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "名称", + "name": "name", + "type": "text" + }, + { + "label": "排序 序号越大越排前面", + "list": false, + "must": false, + "name": "sort", + "sortable": true, + "type": "number" + }, + { + "label": "归属专区", + "link": "category", + "must": false, + "name": "parent_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "创建人员", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "关联部门", + "link": "org", + "name": "org_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "info": false, + "label": "索引", + "list": false, + "must": false, + "name": "index", + "notUse": true, + "type": "index" + } + ], + "label": "事项管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + }, + { + "label": "归属专区", + "link": "category", + "name": "parent_id", + "type": "tree", + "value": "name" + }, + { + "label": "关联部门", + "link": "org", + "name": "org_id", + "type": "tree", + "value": "name" + } + ], + "table": "category" + }, + "furnace_temperature": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "日期", + "name": "name", + "type": "text" + }, + { + "label": "炉温照片", + "list": false, + "must": false, + "name": "img", + "type": "image" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + } + ], + "type": "select" + } + ], + "label": "炉温监控", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "furnace_temperature" + }, + "material": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "原材料名称", + "name": "name", + "type": "text" + }, + { + "label": "图片", + "list": false, + "must": false, + "name": "img", + "type": "image" + }, + { + "label": "当前数量", + "name": "count", + "sortable": true, + "type": "number" + }, + { + "label": "总消耗数", + "name": "used", + "sortable": true, + "type": "number" + }, + { + "label": "总存储数", + "name": "saved", + "sortable": true, + "type": "number" + }, + { + "label": "经办人", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "参数1", + "name": "rule", + "type": "text" + } + ], + "label": "原材料管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "material" + }, + "material_inout": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "图片", + "list": false, + "must": false, + "name": "img", + "type": "image" + }, + { + "label": "出入库数量", + "name": "count", + "sortable": true, + "type": "number" + }, + { + "label": "剩余数量", + "name": "saved", + "sortable": true, + "type": "number" + }, + { + "label": "对应原材料", + "link": "material", + "name": "material_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "经办人", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "入库", + "value": "0" + }, + { + "name": "出库", + "value": "1" + }, + { + "name": "退货", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "参数1", + "name": "rule", + "type": "text" + }, + { + "label": "关联生产计划", + "link": "produce", + "name": "produce_id", + "sortable": true, + "type": "number", + "value": "name" + } + ], + "label": "出入库管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "入库", + "value": "0" + }, + { + "name": "出库", + "value": "1" + }, + { + "name": "退货", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "material_inout" + }, + "org": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "编号", + "name": "sn", + "type": "text" + }, + { + "label": "组织名称", + "name": "name", + "type": "text" + }, + { + "label": "上级组织", + "link": "org", + "must": false, + "name": "parent_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + } + ], + "type": "select" + }, + { + "add": false, + "edit": false, + "label": "注册时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "创建用户", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "info": false, + "label": "索引 格式为逗号分隔,1,2,", + "list": false, + "must": false, + "name": "index", + "notUse": true, + "type": "index" + } + ], + "label": "部门管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + }, + { + "label": "上级组织", + "link": "org", + "name": "parent_id", + "type": "tree", + "value": "name" + } + ], + "table": "org" + }, + "produce": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "计划名", + "name": "name", + "type": "text" + }, + { + "label": "对应成品", + "link": "product", + "name": "product_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "经办人", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "客户", + "link": "user", + "name": "user_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "开始时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "生产状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已完成", + "value": "0" + }, + { + "name": "待生产", + "value": "1" + }, + { + "name": "生产中", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "计划生产总量", + "name": "count", + "sortable": true, + "type": "number" + }, + { + "label": "当前已生产", + "name": "now", + "sortable": true, + "type": "number" + }, + { + "add": false, + "edit": false, + "label": "计划完成时间", + "must": false, + "name": "finish_time", + "type": "time" + }, + { + "label": "其他规则", + "name": "rule", + "type": "text" + } + ], + "label": "生产计划", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "生产状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已完成", + "value": "0" + }, + { + "name": "待生产", + "value": "1" + }, + { + "name": "生产中", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "produce" + }, + "produce_material": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "关联原材料", + "link": "material", + "name": "material_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "计划使用数量", + "name": "count", + "sortable": true, + "type": "number" + }, + { + "label": "已使用数量", + "name": "used", + "sortable": true, + "type": "number" + }, + { + "label": "关联生产计划", + "link": "produce", + "name": "produce_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "生产状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "其他", + "value": "2" + } + ], + "type": "select" + } + ], + "label": "关联原材料", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "生产状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "其他", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "produce_material" + }, + "product": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "成品名称", + "name": "name", + "type": "text" + }, + { + "label": "图片", + "list": false, + "must": false, + "name": "img", + "type": "image" + }, + { + "label": "当前数量", + "name": "count", + "sortable": true, + "type": "number" + }, + { + "label": "总发货量", + "name": "used", + "sortable": true, + "type": "number" + }, + { + "label": "总生产量", + "name": "saved", + "sortable": true, + "type": "number" + }, + { + "label": "抽检覆盖量", + "name": "spot_check_count", + "sortable": true, + "type": "number" + }, + { + "label": "发货抽检总覆盖量", + "name": "spot_check_used", + "sortable": true, + "type": "number" + }, + { + "label": "总抽检总覆盖量", + "name": "spot_check_saved", + "sortable": true, + "type": "number" + }, + { + "label": "经办人", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "参数1", + "name": "rule", + "type": "text" + }, + { + "label": "抽检参数", + "name": "rule_spot_check", + "type": "text" + }, + { + "label": "质检参数", + "name": "rule_check", + "type": "text" + } + ], + "label": "成品管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "product" + }, + "product_check": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "图片", + "list": false, + "must": false, + "name": "img", + "type": "image" + }, + { + "label": "对应成品", + "link": "product", + "name": "product_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "经办人", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "质检结论", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "其他", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "参数1", + "name": "rule", + "type": "text" + }, + { + "label": "生产计划", + "link": "produce", + "name": "produce_id", + "sortable": true, + "type": "number", + "value": "name" + } + ], + "label": "质检管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "质检结论", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "其他", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "product_check" + }, + "product_spot_check": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "图片", + "list": false, + "must": false, + "name": "img", + "type": "image" + }, + { + "label": "对应成品", + "link": "product", + "name": "product_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "label": "经办人", + "link": "admin", + "name": "admin_id", + "sortable": true, + "type": "number", + "value": "name" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "抽检结论", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "其他", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "参数1", + "name": "rule", + "type": "text" + }, + { + "label": "生产计划", + "link": "produce", + "name": "produce_id", + "sortable": true, + "type": "number", + "value": "name" + } + ], + "label": "抽检管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "抽检结论", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "其他", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "product_spot_check" + }, + "role": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "名称", + "name": "name", + "type": "text" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "规则", + "name": "rule", + "type": "text" + } + ], + "label": "角色管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "已启用", + "value": "0" + }, + { + "name": "未启用", + "value": "1" + }, + { + "name": "异常", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "role" + }, + "user": { + "auth": [ + "add", + "delete", + "edit", + "info" + ], + "columns": [ + { + "add": false, + "edit": false, + "label": "ID", + "must": false, + "name": "id", + "sortable": true, + "type": "number" + }, + { + "label": "SN", + "name": "sn", + "type": "text" + }, + { + "label": "用户姓名", + "name": "name", + "type": "text" + }, + { + "label": "公司名称", + "name": "company", + "type": "text" + }, + { + "label": "手机号码", + "name": "phone", + "type": "text" + }, + { + "label": "邮箱", + "list": false, + "must": false, + "name": "email", + "type": "text" + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "隐藏", + "value": "2" + } + ], + "type": "select" + }, + { + "label": "头像", + "list": false, + "must": false, + "name": "avatar", + "type": "image" + }, + { + "add": false, + "edit": false, + "label": "创建时间", + "list": false, + "must": false, + "name": "create_time", + "type": "time" + }, + { + "add": false, + "edit": false, + "label": "变更时间", + "must": false, + "name": "modify_time", + "type": "time" + } + ], + "label": "客户管理", + "search": [ + { + "label": "请输入关键词", + "name": "keyword", + "type": "search", + "value": null + }, + { + "label": "时间段", + "name": "daterange", + "type": "search", + "value": null + }, + { + "label": "排序", + "name": "sort", + "type": "search", + "value": null + }, + { + "label": "状态", + "list": false, + "must": true, + "name": "state", + "options": [ + { + "name": "正常", + "value": "0" + }, + { + "name": "异常", + "value": "1" + }, + { + "name": "隐藏", + "value": "2" + }, + { + "name": "全部", + "value": null + } + ], + "type": "select", + "value": null + } + ], + "table": "user" + } + } +} \ No newline at end of file diff --git a/example/myhs.exe b/example/myhs.exe new file mode 100644 index 0000000..4011867 Binary files /dev/null and b/example/myhs.exe differ diff --git a/example/tpt/file/2021/10/19/3ff12ec004dde6bff0adef0b6daf1cf0.png b/example/tpt/file/2021/10/19/3ff12ec004dde6bff0adef0b6daf1cf0.png new file mode 100644 index 0000000..f7f3d07 Binary files /dev/null and b/example/tpt/file/2021/10/19/3ff12ec004dde6bff0adef0b6daf1cf0.png differ