Exemple #1
0
        /// <summary>
        /// 获取角色分页数据
        /// </summary>
        /// <param name="appid">appid</param>
        /// <param name="page"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public ActionResult PageData(string appid, int page = 1, int size = 10)
        {
            var where = string.IsNullOrEmpty(appid) ? (Expression <Func <Role, bool> >)(g => true) : (g => g.ClientApp.Any(a => a.AppId.Equals(appid)));
            List <int>           ids  = RoleBll.LoadPageEntitiesNoTracking <int, RoleOutputDto>(page, size, out int total, where, a => a.Id, false).Select(g => g.Id).ToList();
            List <RoleOutputDto> list = new List <RoleOutputDto>();

            ids.ForEach(g =>
            {
                List <RoleOutputDto> temp = RoleBll.GetSelfAndChildrenByParentId(g).ToList();
                list.AddRange(temp);
            });
            return(PageResult(list.DistinctBy(u => u.Id), size, total));
        }