Esempio n. 1
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="categorySearchParams"></param>
        /// <returns></returns>
        public virtual PageResult <NavigationMenu> GetNavigationMenuByPage(NavigationMenuSearchParams searchParams)
        {
            var items = this.NavigationMenuRepository.GetNavigationMenuByPage(searchParams);
            var total = this.NavigationMenuRepository.GetNavigationMenuRecordCount(searchParams);

            return(new PageResult <NavigationMenu>(total, items));
        }
        /// <summary>
        /// 查总记录数
        /// </summary>
        /// <param name="searchParams"></param>
        /// <returns></returns>
        public int GetNavigationMenuRecordCount(NavigationMenuSearchParams searchParams)
        {
            var criteria = this.Session.CreateCriteria <NavigationMenu>();

            if (!string.IsNullOrWhiteSpace(searchParams.Keywords))
            {
                // criteria.Add(Restrictions.Like(__CategoryName__, "%" + searchParams.Keywords + "%"));
            }
            criteria.SetProjection(Projections.RowCount());
            int total = (int)criteria.UniqueResult();

            return(total);
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="searchParams">分页查询条件</param>
        /// <returns></returns>
        public List <NavigationMenu> GetNavigationMenuByPage(NavigationMenuSearchParams searchParams)
        {
            var criteria = this.Session.CreateCriteria <NavigationMenu>();

            if (!string.IsNullOrWhiteSpace(searchParams.Keywords))
            {
                // criteria.Add(Restrictions.Like(__CategoryName__, "%" + searchParams.Keywords + "%"));
            }

            //criteria.AddOrder(Order.Asc(__CategoryName__));
            criteria.SetFirstResult(searchParams.GetFirstResult());
            criteria.SetMaxResults(searchParams.GetMaxResults());

            var items = criteria.List <NavigationMenu>().ToList();

            return(items);
        }
Esempio n. 4
0
 public PageResult <NavigationMenu> GetNavigationMenuByPage([FromBody] NavigationMenuSearchParams searchParams)
 {
     return(this.NavigationMenuService.GetNavigationMenuByPage(searchParams));
 }