public IActionResult ParseTree(int?fid) { //找当前层级下级(如果parentId==null那就是第一级) List <Permission> permissions = userGroupBll.GetPermissionList(); List <Permission> list = permissions.Where(a => a.Fid == fid).ToList(); foreach (var item in list) { PermissionTree treeModel = new PermissionTree(); treeModel.Id = item.Pid; treeModel.text = item.Title; //递归 ParseTree(treeModel.Id); treeModels.Add(treeModel); } return(Ok(new { data = treeModels })); }