1234567891011121314151617181920212223 |
- package services
- import (
- "eta/eta_hub/models/data_manage"
- )
- // GetEdbClassifyTreeRecursive 递归指标分类树
- func GetEdbClassifyTreeRecursive(list []*data_manage.EdbClassify, parentId int) []*data_manage.EdbClassifyItem {
- res := make([]*data_manage.EdbClassifyItem, 0)
- for _, v := range list {
- t := new(data_manage.EdbClassifyItem)
- t.ClassifyId = v.ClassifyId
- t.ClassifyName = v.ClassifyName
- t.UniqueCode = v.UniqueCode
- t.ParentId = v.ParentId
- t.Sort = v.Sort
- if v.ParentId == parentId {
- t.Child = GetEdbClassifyTreeRecursive(list, v.ClassifyId)
- res = append(res, t)
- }
- }
- return res
- }
|