|
@@ -84,7 +84,7 @@ func GetIndustryTree()(rootNode *models.CygxIndustryMapItems, err error) {
|
|
|
//获取对应的层级map
|
|
|
func getMap(tree *models.CygxIndustryMapItems,item *models.CygxIndustryMapItems,hasIdMap map[int]string,otherChildMapSlice map[int][]*models.CygxIndustryMapItems){
|
|
|
//深度
|
|
|
- depth := 0
|
|
|
+ depth := 1
|
|
|
|
|
|
//获取下级
|
|
|
childTree := getChildTree(tree,item)
|
|
@@ -120,6 +120,7 @@ func GetIndustryMapNameSlice(industryName string)(nameSlice []string,err error){
|
|
|
tree,err := GetIndustryTree()
|
|
|
if err != nil{
|
|
|
fmt.Println("获取树失败")
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
//fmt.Println(tree)
|
|
@@ -129,6 +130,7 @@ func GetIndustryMapNameSlice(industryName string)(nameSlice []string,err error){
|
|
|
itemList,err := models.GetFirstCygxIndustryListByName(industryName)
|
|
|
if err != nil{
|
|
|
fmt.Println("获取数据失败,",err)
|
|
|
+ return
|
|
|
}
|
|
|
//找不到对应的数据
|
|
|
if len(itemList) <= 0{
|
|
@@ -157,6 +159,8 @@ func GetIndustryMapNameSlice(industryName string)(nameSlice []string,err error){
|
|
|
otherChildMapSlice := map[int][]*models.CygxIndustryMapItems{}
|
|
|
for _,item := range list{
|
|
|
hasIdMap[item.IndustryMapId]=""
|
|
|
+ //将自己的节点给加进去
|
|
|
+ otherChildMapSlice[0] = append(otherChildMapSlice[0],item)
|
|
|
getMap(tree,item,hasIdMap,otherChildMapSlice)
|
|
|
}
|
|
|
var tmpSlice []*models.CygxIndustryMapItems
|