List全部数据组合成树形结构
实体类:
package com.test.vo;
import lombok.Data;
import java.util.List;
/**
* 国民经济行业分类树形返回参数
*
* @author lmp
* @date 2021-04-19
*/
@Data
public class IndustryVo {
private static final long serialVersionUID = 1L;
/**ID*/
private String IndustryId;
/** 字典值 */
private String value;
/** 选项名称 */
private String label;
/** 选项名称 */
private String parentId;
/** 下级节点 */
private List<IndustryVo> children;
}
Controller类
@GetMapping("/getAllData")
@ResponseBody
@ApiOperation("查询所有行业数据-接口")
public AjaxResult getAllData(){
return AjaxResult.success(getChildPerms(industryClient.getAllIndustry(), null))