|
@@ -853,50 +853,48 @@ func (this *SandboxController) SandboxClassifyItems() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- rootList, err := sandbox.GetSandboxClassifyByParentId(sandboxClassifyId)
|
|
|
|
|
|
+ rootList, err := sandbox.GetSandboxClassifyAndInfoByParentId(sandboxClassifyId)
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- classifyAll, err := sandbox.GetSandboxClassifyByParentId(sandboxClassifyId)
|
|
|
|
|
|
+ classifyAll, err := sandbox.GetSandboxClassifyAndInfoByParentId(sandboxClassifyId)
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- sandboxAll, err := sandbox.GetSandboxItemsByClassifyId(sandboxClassifyId)
|
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
- br.Msg = "获取失败"
|
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ //sandboxAll, err := sandbox.GetSandboxItemsByClassifyId(sandboxClassifyId)
|
|
|
|
+ //if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ // br.Msg = "获取失败"
|
|
|
|
+ // br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
|
|
- sandListMap := make(map[int][]*sandbox.SandboxClassifyItems)
|
|
|
|
- for _, v := range sandboxAll {
|
|
|
|
- if _, ok := sandListMap[v.SandboxClassifyId]; !ok {
|
|
|
|
- list := make([]*sandbox.SandboxClassifyItems, 0)
|
|
|
|
- list = append(list, v)
|
|
|
|
- sandListMap[v.SandboxClassifyId] = list
|
|
|
|
- } else {
|
|
|
|
- sandListMap[v.SandboxClassifyId] = append(sandListMap[v.SandboxClassifyId], v)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //sandListMap := make(map[int][]*sandbox.SandboxClassifyItems)
|
|
|
|
+ //for _, v := range sandboxAll {
|
|
|
|
+ // if _, ok := sandListMap[v.SandboxClassifyId]; !ok {
|
|
|
|
+ // list := make([]*sandbox.SandboxClassifyItems, 0)
|
|
|
|
+ // list = append(list, v)
|
|
|
|
+ // sandListMap[v.SandboxClassifyId] = list
|
|
|
|
+ // } else {
|
|
|
|
+ // sandListMap[v.SandboxClassifyId] = append(sandListMap[v.SandboxClassifyId], v)
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
|
|
nodeAll := make([]*sandbox.SandboxClassifyItems, 0)
|
|
nodeAll := make([]*sandbox.SandboxClassifyItems, 0)
|
|
for k := range rootList {
|
|
for k := range rootList {
|
|
rootNode := rootList[k]
|
|
rootNode := rootList[k]
|
|
- sandboxService.SandboxClassifyItemsMakeTree(this.SysUser, classifyAll, rootNode)
|
|
|
|
|
|
+ sandboxService.SandboxClassifyItemsMakeTreeV2(this.SysUser, classifyAll, rootNode)
|
|
nodeAll = append(nodeAll, rootNode)
|
|
nodeAll = append(nodeAll, rootNode)
|
|
}
|
|
}
|
|
- //for k := range nodeAll {
|
|
|
|
- //
|
|
|
|
- //}
|
|
|
|
- newAll := sandboxService.SandboxItemsMakeTree(nodeAll, sandListMap, sandboxClassifyId)
|
|
|
|
|
|
|
|
- resp.AllNodes = newAll
|
|
|
|
|
|
+ //newAll := sandboxService.SandboxItemsMakeTree(nodeAll, sandListMap, sandboxClassifyId)
|
|
|
|
+
|
|
|
|
+ resp.AllNodes = nodeAll
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "获取成功"
|
|
br.Msg = "获取成功"
|
|
@@ -1738,4 +1736,90 @@ func (this *SandboxController) SandboxMove() {
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "移动成功"
|
|
br.Msg = "移动成功"
|
|
-}
|
|
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//// SandboxClassifyItems
|
|
|
|
+//// @Title 获取所有沙盘分类接口-包含沙盘-先分类后沙盘区分,暂时弃用
|
|
|
|
+//// @Description 获取所有沙盘分类接口-包含沙盘
|
|
|
|
+//// @Param IsShowMe query bool true "是否只看我的,true、false"
|
|
|
|
+//// @Success 200 {object} data_manage.ChartClassifyListResp
|
|
|
|
+//// @router /classify/list [get]
|
|
|
|
+//func (this *SandboxController) SandboxClassifyItems() {
|
|
|
|
+// br := new(models.BaseResponse).Init()
|
|
|
|
+// defer func() {
|
|
|
|
+// this.Data["json"] = br
|
|
|
|
+// this.ServeJSON()
|
|
|
|
+// }()
|
|
|
|
+//
|
|
|
|
+// resp := new(sandbox.SandboxClassifyListResp)
|
|
|
|
+// sandboxClassifyId, _ := this.GetInt("SandboxClassifyId")
|
|
|
|
+//
|
|
|
|
+// isShowMe, _ := this.GetBool("IsShowMe")
|
|
|
|
+// if isShowMe {
|
|
|
|
+// errMsg, err := sandboxService.GetSandboxClassifyListForMe(*this.SysUser, resp, sandboxClassifyId)
|
|
|
|
+// if err != nil {
|
|
|
|
+// br.Msg = errMsg
|
|
|
|
+// br.ErrMsg = err.Error()
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+// // 移除没有权限的图表
|
|
|
|
+// //allNodes := sandboxService.HandleNoPermissionSandbox(resp.AllNodes, nil)
|
|
|
|
+// //resp.AllNodes = allNodes
|
|
|
|
+//
|
|
|
|
+// br.Ret = 200
|
|
|
|
+// br.Success = true
|
|
|
|
+// br.Msg = "获取成功"
|
|
|
|
+// br.Data = resp
|
|
|
|
+// fmt.Println("source my classify")
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// rootList, err := sandbox.GetSandboxClassifyByParentId(sandboxClassifyId)
|
|
|
|
+// if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+// br.Msg = "获取失败"
|
|
|
|
+// br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// classifyAll, err := sandbox.GetSandboxClassifyByParentId(sandboxClassifyId)
|
|
|
|
+// if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+// br.Msg = "获取失败"
|
|
|
|
+// br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// sandboxAll, err := sandbox.GetSandboxItemsByClassifyId(sandboxClassifyId)
|
|
|
|
+// if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+// br.Msg = "获取失败"
|
|
|
|
+// br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// sandListMap := make(map[int][]*sandbox.SandboxClassifyItems)
|
|
|
|
+// for _, v := range sandboxAll {
|
|
|
|
+// if _, ok := sandListMap[v.SandboxClassifyId]; !ok {
|
|
|
|
+// list := make([]*sandbox.SandboxClassifyItems, 0)
|
|
|
|
+// list = append(list, v)
|
|
|
|
+// sandListMap[v.SandboxClassifyId] = list
|
|
|
|
+// } else {
|
|
|
|
+// sandListMap[v.SandboxClassifyId] = append(sandListMap[v.SandboxClassifyId], v)
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// nodeAll := make([]*sandbox.SandboxClassifyItems, 0)
|
|
|
|
+// for k := range rootList {
|
|
|
|
+// rootNode := rootList[k]
|
|
|
|
+// sandboxService.SandboxClassifyItemsMakeTree(this.SysUser, classifyAll, rootNode)
|
|
|
|
+// nodeAll = append(nodeAll, rootNode)
|
|
|
|
+// }
|
|
|
|
+// //for k := range nodeAll {
|
|
|
|
+// //
|
|
|
|
+// //}
|
|
|
|
+// newAll := sandboxService.SandboxItemsMakeTree(nodeAll, sandListMap, sandboxClassifyId)
|
|
|
|
+//
|
|
|
|
+// resp.AllNodes = newAll
|
|
|
|
+// br.Ret = 200
|
|
|
|
+// br.Success = true
|
|
|
|
+// br.Msg = "获取成功"
|
|
|
|
+// br.Data = resp
|
|
|
|
+//}
|