实现多级树形结构查询 比如分类(父分类、子分类)

实现多级树形结构查询 比如分类(父分类、子分类)

数据库表结构

sql 复制代码
CREATE TABLE `course_category` (
  `id` varchar(20) NOT NULL COMMENT '主键',
  `name` varchar(32) NOT NULL COMMENT '分类名称',
  `label` varchar(32) DEFAULT NULL COMMENT '分类标签默认和名称一样',
  `parentid` varchar(20) NOT NULL DEFAULT '0' COMMENT '父结点id(第一级的父节点是0,自关联字段id)',
  `is_show` tinyint DEFAULT NULL COMMENT '是否显示',
  `orderby` int DEFAULT NULL COMMENT '排序字段',
  `is_leaf` tinyint DEFAULT NULL COMMENT '是否叶子',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='课程分类';

仅用于分类级别固定

比如固定两级或者三级可以用 表的自连接

sql 复制代码
SELECT
	one.id one_id,
	one.label one_label,
	two.id two_id,
	two.label two_label 
FROM
	course_category one
	INNER JOIN course_category two ON one.id = two.parentid 
WHERE
	one.parentid = '1' 
	AND one.is_show = '1' 
	AND two.is_show = '1' 
ORDER BY
	one.orderby,
	two.orderby;

递归查询方法mysql8支持(灵活)

递归并不会降低数据库的性能,但是为了避免无限递归 默认递归次数为1000次,可以通过设置cte_max_recursion_depth参数增加递归深度还可以设置max_execution_time限制执行时间,超过此时间也会终止递归操作。

根据子查到所有的父

sql 复制代码
WITH recursive t1 as(
	select * from course_category where id ='1-1-1'
	UNION all
	select course_category.* from course_category INNER JOIN t1 on t1.parentid= course_category.id
)
SELECT * from t1 order by t1.id, t1.orderby;

根据父查到所有的子

sql 复制代码
WITH recursive t2 as(
	select * from course_category where id ='1'
	UNION all
	select course_category.* from course_category INNER JOIN t2 on t2.id= course_category.parentid
)
SELECT * from t2 order by t2.id, t2.orderby;

java 代码实现

实体类po
java 复制代码
package com.jhj.content.model.po;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * <p>
 * 课程分类
 * </p>
 *
 * @author jhj
 */
@Data
@TableName("course_category")
public class CourseCategory implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private String id;

    /**
     * 分类名称
     */
    private String name;

    /**
     * 分类标签默认和名称一样
     */
    private String label;

    /**
     * 父结点id(第一级的父节点是0,自关联字段id)
     */
    private String parentid;

    /**
     * 是否显示
     */
    private Integer isShow;

    /**
     * 排序字段
     */
    private Integer orderby;

    /**
     * 是否叶子
     */
    private Integer isLeaf;


}
返回信息封装
java 复制代码
package com.jhj.content.model.dto;

import com.jhj.content.model.po.CourseCategory;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

/**
 * @author jhj
 * @version 1.0.0
 * @ClassName CourseCategoryTreeDto.java
 * @Description 课程分类树形结构
 * @createTime 2024年05月22日 15:18:00
 */
@Data
@ToString
public class CourseCategoryTreeDto extends CourseCategory implements Serializable {
    List<CourseCategoryTreeDto> childrenTreeNodes;
}
mapper.xml
xml 复制代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jhj.content.mapper.CourseCategoryMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.jhj.content.model.po.CourseCategory">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="label" property="label" />
        <result column="parentid" property="parentid" />
        <result column="is_show" property="isShow" />
        <result column="orderby" property="orderby" />
        <result column="is_leaf" property="isLeaf" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, label, parentid, is_show, orderby, is_leaf
    </sql>

    <select id="selectTreeNode" parameterType="string" resultType="com.jhj.content.model.dto.CourseCategoryTreeDto">
        WITH recursive t2 as(
            select * from course_category where id =#{id}
            UNION all
            select course_category.* from course_category INNER JOIN t2 on t2.id= course_category.parentid
        )
        SELECT * from t2 order by t2.id, t2.orderby;
    </select>
</mapper>
mapper
java 复制代码
package com.jhj.content.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jhj.content.model.dto.CourseCategoryTreeDto;
import com.jhj.content.model.po.CourseCategory;

import java.util.List;

/**
 * <p>
 * 课程分类 Mapper 接口
 * </p>
 *
 * @author jhj
 */
public interface CourseCategoryMapper extends BaseMapper<CourseCategory> {

    //使用递归查询分类
    public List<CourseCategoryTreeDto> selectTreeNode(String id);
}
service
java 复制代码
package com.jhj.content.service;

import com.jhj.content.model.dto.CourseCategoryTreeDto;

import java.util.List;

/**
 * @author jhj
 * @version 1.0.0
 * @ClassName CourseCategoryService.java
 * @Description 课程分类实现接口
 * @createTime 2024年05月22日 18:10:00
 */
public interface CourseCategoryService {
    public List<CourseCategoryTreeDto> queryTreeNodes(String id);
}
serviceImpl
java 复制代码
package com.jhj.content.service.impl;

import com.jhj.content.mapper.CourseCategoryMapper;
import com.jhj.content.model.dto.CourseCategoryTreeDto;
import com.jhj.content.service.CourseCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author jhj
 * @version 1.0.0
 * @ClassName CourseCategoryServiceImpl.java
 * @Description 课程分类实现类
 * @createTime 2024年05月22日 18:10:00
 */
@Service
@Slf4j
public class CourseCategoryServiceImpl implements CourseCategoryService {
    
    @Autowired
    CourseCategoryMapper courseCategoryMapper;
    
    @Override
    public List<CourseCategoryTreeDto> queryTreeNodes(String id) {
        List<CourseCategoryTreeDto> res=new ArrayList<>();
        //调用mapper 递归查询出分类信息
        List<CourseCategoryTreeDto> courseCategoryTreeDtos = courseCategoryMapper.selectTreeNode(id);
        //找到每个节点的子节点,最终封装成List<CourseCategoryTreeDto>
        //先将list 转换为map key为节点id,value为对象 目的是方便从map 获取节点 filter(item->!id.equals(item.getId()))排除根节点
        Map<String, CourseCategoryTreeDto> map = courseCategoryTreeDtos.stream().filter(item->!id.equals(item.getId())).collect(Collectors.toMap(key -> key.getId(), value -> value, (key1, key2) -> key2));
        courseCategoryTreeDtos.stream().filter(item->!id.equals(item.getId())).forEach(item->{
            if(item.getParentid().equals(id)){
                res.add(item);
            }
            //找到父节点
            CourseCategoryTreeDto courseCategoryTreeDto = map.get(item.getParentid());
            if(courseCategoryTreeDto!=null) {
                //如果子为空 则new一个
                if (courseCategoryTreeDto.getChildrenTreeNodes() == null) {
                    courseCategoryTreeDto.setChildrenTreeNodes(new ArrayList<CourseCategoryTreeDto>());
                }
                //往子里放
                courseCategoryTreeDto.getChildrenTreeNodes().add(item);
            }

        });
        //从头遍历list 一边遍历一边查找子节点放在父节点的childrenTreeNodes中

        return res;
    }
}
controller
java 复制代码
package com.jhj.content.api;

import com.jhj.content.model.dto.CourseCategoryTreeDto;
import com.jhj.content.service.CourseCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author jhj
 * @version 1.0.0
 * @ClassName CourseCategoryController.java
 * @Description 课程分类接口
 * @createTime 2024年05月13日 01:00:00
 */
@Tag(name = "课程分类管理接口",description = "课程分类管理接口")
@RestController
public class CourseCategoryController {
    @Autowired
    CourseCategoryService courseCategoryService;

    @Operation(summary = "课程分类树形数据")
    @GetMapping("/course-category/tree-nodes")
    public List<CourseCategoryTreeDto> queryTreeNodes(){

        return courseCategoryService.queryTreeNodes("1");
    }
}
接口响应结果
json 复制代码
[
  {
    "id": "1-1",
    "name": "前端开发",
    "label": "前端开发",
    "parentid": "1",
    "isShow": 1,
    "orderby": 1,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-1-1",
        "name": "HTML/CSS",
        "label": "HTML/CSS",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-10",
        "name": "其它",
        "label": "其它",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 10,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-2",
        "name": "JavaScript",
        "label": "JavaScript",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-3",
        "name": "jQuery",
        "label": "jQuery",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-4",
        "name": "ExtJS",
        "label": "ExtJS",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-5",
        "name": "AngularJS",
        "label": "AngularJS",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-6",
        "name": "ReactJS",
        "label": "ReactJS",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-7",
        "name": "Bootstrap",
        "label": "Bootstrap",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-8",
        "name": "Node.js",
        "label": "Node.js",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-1-9",
        "name": "Vue",
        "label": "Vue",
        "parentid": "1-1",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-10",
    "name": "研发管理",
    "label": "研发管理",
    "parentid": "1",
    "isShow": 1,
    "orderby": 10,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-10-1",
        "name": "敏捷开发",
        "label": "敏捷开发",
        "parentid": "1-10",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-10-2",
        "name": "软件设计",
        "label": "软件设计",
        "parentid": "1-10",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-10-3",
        "name": "软件测试",
        "label": "软件测试",
        "parentid": "1-10",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-10-4",
        "name": "研发管理",
        "label": "研发管理",
        "parentid": "1-10",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-10-5",
        "name": "其它",
        "label": "其它",
        "parentid": "1-10",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-11",
    "name": "系统运维",
    "label": "系统运维",
    "parentid": "1",
    "isShow": 1,
    "orderby": 11,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-11-1",
        "name": "Linux",
        "label": "Linux",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-10",
        "name": "其它",
        "label": "其它",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 10,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-2",
        "name": "Windows",
        "label": "Windows",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-3",
        "name": "UNIX",
        "label": "UNIX",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-4",
        "name": "Mac OS",
        "label": "Mac OS",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-5",
        "name": "网络技术",
        "label": "网络技术",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-6",
        "name": "路由协议",
        "label": "路由协议",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-7",
        "name": "无线网络",
        "label": "无线网络",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-8",
        "name": "Ngnix",
        "label": "Ngnix",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-11-9",
        "name": "邮件服务器",
        "label": "邮件服务器",
        "parentid": "1-11",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-12",
    "name": "产品经理",
    "label": "产品经理",
    "parentid": "1",
    "isShow": 1,
    "orderby": 12,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-12-1",
        "name": "交互设计",
        "label": "交互设计",
        "parentid": "1-12",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-12-2",
        "name": "产品设计",
        "label": "产品设计",
        "parentid": "1-12",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-12-3",
        "name": "原型设计",
        "label": "原型设计",
        "parentid": "1-12",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-12-4",
        "name": "用户体验",
        "label": "用户体验",
        "parentid": "1-12",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-12-5",
        "name": "需求分析",
        "label": "需求分析",
        "parentid": "1-12",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-12-6",
        "name": "其它",
        "label": "其它",
        "parentid": "1-12",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-13",
    "name": "企业/办公/职场",
    "label": "企业/办公/职场",
    "parentid": "1",
    "isShow": 1,
    "orderby": 13,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-13-1",
        "name": "运营管理",
        "label": "运营管理",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-2",
        "name": "企业信息化",
        "label": "企业信息化",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-3",
        "name": "网络营销",
        "label": "网络营销",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-4",
        "name": "Office/WPS",
        "label": "Office/WPS",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-5",
        "name": "招聘/面试",
        "label": "招聘/面试",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-6",
        "name": "电子商务",
        "label": "电子商务",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-7",
        "name": "CRM",
        "label": "CRM",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-8",
        "name": "ERP",
        "label": "ERP",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-13-9",
        "name": "其它",
        "label": "其它",
        "parentid": "1-13",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-14",
    "name": "信息安全",
    "label": "信息安全",
    "parentid": "1",
    "isShow": 1,
    "orderby": 14,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-14-1",
        "name": "密码学/加密/破解",
        "label": "密码学/加密/破解",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-10",
        "name": "其它",
        "label": "其它",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 10,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-2",
        "name": "渗透测试",
        "label": "渗透测试",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-3",
        "name": "社会工程",
        "label": "社会工程",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-4",
        "name": "漏洞挖掘与利用",
        "label": "漏洞挖掘与利用",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-5",
        "name": "云安全",
        "label": "云安全",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-6",
        "name": "防护加固",
        "label": "防护加固",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-7",
        "name": "代码审计",
        "label": "代码审计",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-8",
        "name": "移动安全",
        "label": "移动安全",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-14-9",
        "name": "病毒木马",
        "label": "病毒木马",
        "parentid": "1-14",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-15",
    "name": "测试目录",
    "label": "测试目录",
    "parentid": "1",
    "isShow": 1,
    "orderby": 15,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-15-1",
        "name": "测试目录01",
        "label": "测试目录01",
        "parentid": "1-15",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-2",
    "name": "移动开发",
    "label": "移动开发",
    "parentid": "1",
    "isShow": 1,
    "orderby": 2,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-2-1",
        "name": "微信开发",
        "label": "微信开发",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-2-2",
        "name": "iOS",
        "label": "iOS",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-2-3",
        "name": "手游开发",
        "label": "手游开发",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-2-4",
        "name": "Swift",
        "label": "Swift",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-2-5",
        "name": "Android",
        "label": "Android",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-2-6",
        "name": "ReactNative",
        "label": "ReactNative",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-2-7",
        "name": "Cordova",
        "label": "Cordova",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-2-8",
        "name": "其它",
        "label": "其它",
        "parentid": "1-2",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-3",
    "name": "编程开发",
    "label": "编程开发",
    "parentid": "1",
    "isShow": 1,
    "orderby": 3,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-3-1",
        "name": "C/C++",
        "label": "C/C++",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-3-2",
        "name": "Java",
        "label": "Java",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-3-3",
        "name": ".NET",
        "label": ".NET",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-3-4",
        "name": "Objective-C",
        "label": "Objective-C",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-3-5",
        "name": "Go语言",
        "label": "Go语言",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-3-6",
        "name": "Python",
        "label": "Python",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-3-7",
        "name": "Ruby/Rails",
        "label": "Ruby/Rails",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-3-8",
        "name": "其它",
        "label": "其它",
        "parentid": "1-3",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-4",
    "name": "数据库",
    "label": "数据库",
    "parentid": "1",
    "isShow": 1,
    "orderby": 4,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-4-1",
        "name": "Oracle",
        "label": "Oracle",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-2",
        "name": "MySQL",
        "label": "MySQL",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-3",
        "name": "SQL Server",
        "label": "SQL Server",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-4",
        "name": "DB2",
        "label": "DB2",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-5",
        "name": "NoSQL",
        "label": "NoSQL",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-6",
        "name": "Mongo DB",
        "label": "Mongo DB",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-7",
        "name": "Hbase",
        "label": "Hbase",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-8",
        "name": "数据仓库",
        "label": "数据仓库",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-4-9",
        "name": "其它",
        "label": "其它",
        "parentid": "1-4",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-5",
    "name": "人工智能",
    "label": "人工智能",
    "parentid": "1",
    "isShow": 1,
    "orderby": 5,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-5-1",
        "name": "机器学习",
        "label": "机器学习",
        "parentid": "1-5",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-5-2",
        "name": "深度学习",
        "label": "深度学习",
        "parentid": "1-5",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-5-3",
        "name": "语音识别",
        "label": "语音识别",
        "parentid": "1-5",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-5-4",
        "name": "计算机视觉",
        "label": "计算机视觉",
        "parentid": "1-5",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-5-5",
        "name": "NLP",
        "label": "NLP",
        "parentid": "1-5",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-5-6",
        "name": "强化学习",
        "label": "强化学习",
        "parentid": "1-5",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-5-7",
        "name": "其它",
        "label": "其它",
        "parentid": "1-5",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-6",
    "name": "云计算/大数据",
    "label": "云计算/大数据",
    "parentid": "1",
    "isShow": 1,
    "orderby": 6,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-6-1",
        "name": "Spark",
        "label": "Spark",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-2",
        "name": "Hadoop",
        "label": "Hadoop",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-3",
        "name": "OpenStack",
        "label": "OpenStack",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-4",
        "name": "Docker/K8S",
        "label": "Docker/K8S",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-5",
        "name": "云计算基础架构",
        "label": "云计算基础架构",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-6",
        "name": "虚拟化技术",
        "label": "虚拟化技术",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-7",
        "name": "云平台",
        "label": "云平台",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-8",
        "name": "ELK",
        "label": "ELK",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-6-9",
        "name": "其它",
        "label": "其它",
        "parentid": "1-6",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-7",
    "name": "UI设计",
    "label": "UI设计",
    "parentid": "1",
    "isShow": 1,
    "orderby": 7,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-7-1",
        "name": "Photoshop",
        "label": "Photoshop",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-10",
        "name": "InDesign",
        "label": "InDesign",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 10,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-11",
        "name": "Pro/Engineer",
        "label": "Pro/Engineer",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 11,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-12",
        "name": "Cinema 4D",
        "label": "Cinema 4D",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 12,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-13",
        "name": "3D Studio",
        "label": "3D Studio",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 13,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-14",
        "name": "After Effects(AE)",
        "label": "After Effects(AE)",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 14,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-15",
        "name": "原画设计",
        "label": "原画设计",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 15,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-16",
        "name": "动画制作",
        "label": "动画制作",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 16,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-17",
        "name": "Dreamweaver",
        "label": "Dreamweaver",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 17,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-18",
        "name": "Axure",
        "label": "Axure",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 18,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-19",
        "name": "其它",
        "label": "其它",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 19,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-2",
        "name": "3Dmax",
        "label": "3Dmax",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-3",
        "name": "Illustrator",
        "label": "Illustrator",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-4",
        "name": "Flash",
        "label": "Flash",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-5",
        "name": "Maya",
        "label": "Maya",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-6",
        "name": "AUTOCAD",
        "label": "AUTOCAD",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-7",
        "name": "UG",
        "label": "UG",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-8",
        "name": "SolidWorks",
        "label": "SolidWorks",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-7-9",
        "name": "CorelDraw",
        "label": "CorelDraw",
        "parentid": "1-7",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-8",
    "name": "游戏开发",
    "label": "游戏开发",
    "parentid": "1",
    "isShow": 1,
    "orderby": 8,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-8-1",
        "name": "Cocos",
        "label": "Cocos",
        "parentid": "1-8",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-8-2",
        "name": "Unity3D",
        "label": "Unity3D",
        "parentid": "1-8",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-8-3",
        "name": "Flash",
        "label": "Flash",
        "parentid": "1-8",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-8-4",
        "name": "SpriteKit 2D",
        "label": "SpriteKit 2D",
        "parentid": "1-8",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-8-5",
        "name": "Unreal",
        "label": "Unreal",
        "parentid": "1-8",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-8-6",
        "name": "其它",
        "label": "其它",
        "parentid": "1-8",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  },
  {
    "id": "1-9",
    "name": "智能硬件/物联网",
    "label": "智能硬件/物联网",
    "parentid": "1",
    "isShow": 1,
    "orderby": 9,
    "isLeaf": 0,
    "childrenTreeNodes": [
      {
        "id": "1-9-1",
        "name": "无线通信",
        "label": "无线通信",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 1,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-10",
        "name": "物联网技术",
        "label": "物联网技术",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 10,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-11",
        "name": "其它",
        "label": "其它",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 11,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-2",
        "name": "电子工程",
        "label": "电子工程",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 2,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-3",
        "name": "Arduino",
        "label": "Arduino",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 3,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-4",
        "name": "体感技术",
        "label": "体感技术",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 4,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-5",
        "name": "智能硬件",
        "label": "智能硬件",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 5,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-6",
        "name": "驱动/内核开发",
        "label": "驱动/内核开发",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 6,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-7",
        "name": "单片机/工控",
        "label": "单片机/工控",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 7,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-8",
        "name": "WinCE",
        "label": "WinCE",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 8,
        "isLeaf": 1,
        "childrenTreeNodes": null
      },
      {
        "id": "1-9-9",
        "name": "嵌入式",
        "label": "嵌入式",
        "parentid": "1-9",
        "isShow": 1,
        "orderby": 9,
        "isLeaf": 1,
        "childrenTreeNodes": null
      }
    ]
  }
]

本项目为开源项目,后续会接入多种功能,项目地址https://gitee.com/jhj-coding/jhj-ultimate-project,欢迎大家多多star。

作者声明

handlebars 复制代码
如有问题,欢迎指正!
相关推荐
易云码4 分钟前
信息安全建设方案,网络安全等保测评方案,等保技术解决方案,等保总体实施方案(Word原件)
数据库·物联网·安全·web安全·低代码
向阳12187 分钟前
Dubbo负载均衡
java·运维·负载均衡·dubbo
newxtc10 分钟前
【客观理性深入讨论国产中间件及数据库-科创基础软件】
数据库·中间件·国产数据库·国产中间件·科创
水月梦镜花12 分钟前
redis:list列表命令和内部编码
数据库·redis·list
Gu Gu Study17 分钟前
【用Java学习数据结构系列】泛型上界与通配符上界
java·开发语言
WaaTong40 分钟前
《重学Java设计模式》之 原型模式
java·设计模式·原型模式
m0_7430484440 分钟前
初识Java EE和Spring Boot
java·java-ee
AskHarries42 分钟前
Java字节码增强库ByteBuddy
java·后端
MonkeyKing_sunyuhua1 小时前
ubuntu22.04 docker-compose安装postgresql数据库
数据库·docker·postgresql
天郁青1 小时前
数据库交互的本地项目:后台管理系统
数据库·交互