移动系统liao
2025-02-17 557c2711a3e103ebc3d0492344eca9730d5e92b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/***********************************************************************
 *            Project: baifenBinfa.Net                                     *
 *                Web: https://baifenBinfa.com                             *
 *        ProjectName: 百分兵法管理系统                               *
 *             Author:                                        *
 *              Email:                               *
 *         CreateTime: 2020-07-16 1:39:49
 *        Description: 暂无
 ***********************************************************************/
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoreCms.Net.Model.Entities;
 
namespace CoreCms.Net.Utility.Helper
{
    /// <summary>
    /// 组织机构帮助类
    /// </summary>
    public static class SysOrganizationHelper
    {
 
        /// <summary>
        /// 获取组织结构树
        /// </summary>
        /// <param name="list"></param>
        /// <param name="id"></param>
        /// <param name="treeNodes"></param>
        /// <returns></returns>
        public static void GetOrganizeChildIds(List<SysOrganization> list, int id, ref List<int> treeNodes)
        {
            treeNodes.Add(id);
            if (list == null) return;
            List<SysOrganization> sublist;
            sublist = list.Where(t => t.parentId == id).ToList();
            if (!sublist.Any()) return;
            foreach (var item in sublist)
            {
                GetOrganizeChildIds(list, item.id, ref treeNodes);
            }
        }
 
    }
}