public IEnumerable <VIEW_FW_MODULEPERMISSION> GetAllModulePermission()
        {
            try
            {
                List <VIEW_FW_MODULEPERMISSION> listDepart = new List <VIEW_FW_MODULEPERMISSION>();
                var data = idal.LoadListBy(mp => true).Select(mp => new VIEW_FW_MODULEPERMISSION()
                {
                    PERMISSION_ID  = mp.FW_PERMISSION.PERMISSION_ID,
                    PERMISSION_PID = mp.FW_PERMISSION.PERMISSION_PID,
                    MODULE_NAME    = mp.FW_MODULE.MODULE_NAME,
                    NAME           = mp.FW_PERMISSION.NAME,
                    ICON           = mp.FW_PERMISSION.ICON,
                    REMARK         = mp.FW_PERMISSION.REMARK,
                    MP_ID          = mp.MP_ID,
                    MODULE_ID      = mp.FW_MODULE.MODULE_ID,
                    SEQ_NO         = mp.FW_PERMISSION.SEQ_NO
                }).ToList();
                var ParentPermission = data.Where(con => con.PERMISSION_PID == "");
                foreach (var parent in ParentPermission)
                {
                    //实体转化
                    VIEW_FW_MODULEPERMISSION parentItem = parent;
                    //获取子级
                    GetModulePermissionChildren(ref parentItem, data.ToList());
                    listDepart.Add(parentItem);
                }

                return(ParentPermission);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 /// <summary>
 /// 获取子集
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="allList"></param>
 public void GetModulePermissionChildren(ref VIEW_FW_MODULEPERMISSION parent, List <VIEW_FW_MODULEPERMISSION> allList)
 {
     foreach (VIEW_FW_MODULEPERMISSION permission in allList)
     {
         var MPID = parent.MODULE_ID + "_" + permission.PERMISSION_ID;
         if (permission.PERMISSION_PID == parent.PERMISSION_ID && permission.MP_ID == MPID)
         {
             //实体转化
             VIEW_FW_MODULEPERMISSION child = permission;
             if (parent.children == null)
             {
                 parent.children = new List <VIEW_FW_MODULEPERMISSION>();
             }
             //添加到父级的Children中
             parent.children.Add(child);
             GetModulePermissionChildren(ref child, allList);//递归添加子树
         }
     }
 }