Mybatis自查询递归查找子菜单(三级)

实体类:

import java.util.List;

public class TaskTypeConcatenationDto {

    private Integer id;

    private String title;

    private List taskTypeList;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public List getTaskTypeList() {
        return taskTypeList;
    }

    public void setTaskTypeList(List taskTypeList) {
        this.taskTypeList = taskTypeList;
    }
}

 mapper.xml文件:


    
        
        
        
        
    
    
    
        
        
        
        
    

    
    

    
    

    
    

在swagger-ui.html上测试的结果如下:

{
  "StatusCode": 0,
  "Succeed": true,
  "Message": "查询成功!",
  "Data": {
    "data": [
      {
        "id": 155,
        "title": "高级管理",
        "taskTypeList": [
          {
            "id": 156,
            "title": "高级管理职位",
            "taskTypeList": [
              {
                "id": 157,
                "title": "CEO/总裁/总经理",
                "taskTypeList": null
              },
              {
                "id": 158,
                "title": "副总裁/副总经理",
                "taskTypeList": null
              },
              {
                "id": 159,
                "title": "事业部负责人",
                "taskTypeList": null
              },
              {
                "id": 160,
                "title": "区域/分公司/代表处负责人",
                "taskTypeList": null
              },
              {
                "id": 161,
                "title": "总裁/总经理/董事长助理",
                "taskTypeList": null
              },
              {
                "id": 162,
                "title": "合伙人",
                "taskTypeList": null
              },
              {
                "id": 163,
                "title": "创始人",
                "taskTypeList": null
              },
              {
                "id": 164,
                "title": "董事会秘书",
                "taskTypeList": null
              }
            ]
          }
        ]
      }
    ],
    "dataTotal": 1,
    "pageTotal": 1
  }
}

 

 

你可能感兴趣的:(Mybatis自查询递归查找子菜单(三级))