Example #1
0
        public async Task <List <MenuEntity> > GetList(MenuListParam param)
        {
            var expression = ListFilter(param);
            var list       = await this.BaseRepository().FindList <MenuEntity>(expression);

            return(list.OrderBy(p => p.MenuSort).ToList());
        }
Example #2
0
        /// <summary>
        ///     通过权限条件 获取菜单id
        /// </summary>
        /// <param name="menuListParam"></param>
        /// <returns></returns>
        public async Task <List <long> > GetMenuIdList(MenuListParam param)
        {
            var query = _menuAuthorizeEntityDB.AsQueryable();

            if (param != null)
            {
                if (param.AuthorizeId.HasValue)
                {
                    query = query.Where(t => t.AuthorizeId == param.AuthorizeId);
                }

                if (param.AuthorizeType.HasValue)
                {
                    query = query.Where(t => t.AuthorizeType == param.AuthorizeType);
                }

                if (!param.AuthorizeIds.IsEmpty())
                {
                    var authorizeIdArr = TextHelper.SplitToArray <long>(param.AuthorizeIds, ',');
                    query = query.Where(t => authorizeIdArr.Contains(t.AuthorizeId.Value));
                }
            }

            var menuIds = await query.Select(a => a.MenuId.GetValueOrDefault()).ToListAsync();

            return(menuIds);
        }
Example #3
0
        public async Task <TData <List <MenuEntity> > > GetPageListJson([FromQuery] MenuListParam param,
                                                                        [FromQuery] Pagination pagination)
        {
            var obj = await _menuBLL.GetPageList(param, pagination);

            return(obj);
        }
Example #4
0
        public async Task <TData <List <MenuEntity> > > GetList(MenuListParam param)
        {
            var obj = new TData <List <MenuEntity> >();

            obj.Data = await _menuService.GetList(param);

            obj.Tag = 1;
            return(obj);
        }
Example #5
0
        public async Task <TData <List <MenuEntity> > > GetPageList(MenuListParam param, Pagination pagination)
        {
            var obj = new TData <List <MenuEntity> >();

            obj.Data = await _menuService.GetPageList(param, pagination);

            obj.Total = pagination.TotalCount;
            obj.Tag   = 1;
            return(obj);
        }
Example #6
0
        public async Task <TData <List <MenuEntity> > > GetList(MenuListParam param)
        {
            var obj = new TData <List <MenuEntity> >();

            List <MenuEntity> list = await menuCache.GetList();

            list = ListFilter(param, list);

            obj.Data = list;
            obj.Tag  = 1;
            return(obj);
        }
Example #7
0
 private List <MenuEntity> ListFilter(MenuListParam param, List <MenuEntity> list)
 {
     if (param != null)
     {
         if (!string.IsNullOrEmpty(param.MenuName))
         {
             list = list.Where(p => p.MenuName.Contains(param.MenuName)).ToList();
         }
         if (param.MenuStatus > 0)
         {
             list = list.Where(p => p.MenuStatus == param.MenuStatus).ToList();
         }
     }
     return(list);
 }
Example #8
0
        /// <summary>
        ///     带条件查询所有
        /// </summary>
        public async Task <List <MenuEntity> > GetList(MenuListParam param)
        {
            #region 查询条件

            var query = _menuEntityDB.AsQueryable();

            /*
             *
             */

            #endregion

            var data = await query.ToListAsync();

            return(data);
        }
Example #9
0
        private Expression <Func <MenuEntity, bool> > ListFilter(MenuListParam param)
        {
            var expression = LinqExtensions.True <MenuEntity>();

            if (param != null)
            {
                if (!string.IsNullOrEmpty(param.MenuName))
                {
                    expression = expression.And(t => t.MenuName.Contains(param.MenuName));
                }
                if (param.MenuStatus > -1)
                {
                    expression = expression.And(t => t.MenuStatus == param.MenuStatus);
                }
            }
            return(expression);
        }
Example #10
0
        /// <summary>
        ///     分页查询
        /// </summary>
        public async Task <List <MenuEntity> > GetPageList(MenuListParam param, Pagination pagination)
        {
            #region 查询条件

            var query = _menuEntityDB.AsQueryable();

            /*
             *
             */
            var data = await query.OrderByDescending(a => a.Id)
                       .ToPagedListAsync(pagination.PageIndex, pagination.PageSize);

            #endregion

            // 分页参数赋值
            pagination.TotalCount = data.TotalCount;
            return(data.Items.ToList());
        }
Example #11
0
        public async Task <TData <List <ZtreeInfo> > > GetZtreeList(MenuListParam param)
        {
            var obj = new TData <List <ZtreeInfo> >();

            obj.Data = new List <ZtreeInfo>();

            List <MenuEntity> list = await menuCache.GetList();

            list = ListFilter(param, list);

            foreach (MenuEntity menu in list)
            {
                obj.Data.Add(new ZtreeInfo
                {
                    id   = menu.Id,
                    pId  = menu.ParentId,
                    name = menu.MenuName
                });
            }

            obj.Tag = 1;
            return(obj);
        }
Example #12
0
        public async Task <IActionResult> GetMenuTreeListJson(MenuListParam param)
        {
            TData <List <ZtreeInfo> > obj = await sysMenuBLL.GetZtreeList(param);

            return(Json(obj));
        }
Example #13
0
        public async Task <IActionResult> GetListJson(MenuListParam param)
        {
            TData <List <MenuEntity> > obj = await sysMenuBLL.GetList(param);

            return(Json(obj));
        }
Example #14
0
        public async Task <TData <List <MenuEntity> > > GetListJson([FromQuery] MenuListParam param)
        {
            var obj = await _menuBLL.GetList(param);

            return(obj);
        }