public void ExportMenuPerms(Query <SYS_Action, MenuParams> query) { var where = PredicateBuilder.True <SYS_Action>(); where = where.And(m => m.SystemId == query.Params.SystemId); var list = this.actionService.GetMenuList(where).OrderBy(m => m.LevelSort).ToList(); MenuHelper.UpdateMenuName(list); var permList = actionService.GetActionPerms(); var exportList = new List <ExportMenuPerms>(); var perms = actionService.GetPerms(query.Params.SystemId); foreach (var a in list) { var perm = permList.FirstOrDefault(p => p.ActionId == a.ActionId); if (perm != null) { var permCodes = perm.PermCode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var isFirst = true; foreach (var code in permCodes) { var model = new ExportMenuPerms(); if (isFirst) { model.MenuName = a.ActionName; isFirst = false; } var p = perms.FirstOrDefault(c => c.PermCode == int.Parse(code)); model.PermissionName = p == null ? "" : p.PermName; exportList.Add(model); } } else { var model = new ExportMenuPerms(); model.MenuName = a.ActionName; exportList.Add(model); } } excelClient.HttpExport(exportList, "菜单列表" + DateTime.Now.ToString("yyyyMMddHHmmss")); }