예제 #1
0
 /// <summary>
 /// 分页查询
 /// </summary>
 /// <param name="condition">条件</param>
 /// <param name="orderBy">排序条件</param>
 /// <param name="pageSize">页大小</param>
 /// <param name="pageNum">页码</param>
 /// <returns></returns>
 public IList <TEntity> QueryPage(ICondition condition, OrderByGroup orderBy, int pageSize, int pageNum)
 {
     return
         (session.CreateQuery(string.Format("FROM {0} WHERE {1} ORDER BY {2}", entityType.Name, condition.ToHql(),
                                            orderBy.ToHql())).SetMaxResults(pageSize).SetFirstResult(
              (pageNum - 1) * pageSize).List <TEntity>());
 }
예제 #2
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="condition">条件</param>
        /// <param name="orderBy">排序条件</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="pageNum">页码</param>
        /// <returns></returns>
        public IList <TEntity> QueryPage(ICondition condition, OrderByGroup orderBy, int pageSize, int pageNum)
        {
            IConditionGroup group = RepositoryHelper.ToConditionGroup(condition).Add(isLogicDeleteCondition);

            return
                (session.CreateQuery(string.Format("FROM  {0} where {1} Order By {2}", entityType.Name, group.ToHql(),
                                                   orderBy.ToHql())).SetParameters(group.Parameters).SetFirstResult(
                     (pageNum - 1) * pageSize).SetMaxResults(pageNum).List <TEntity>());
        }
예제 #3
0
        /// <summary>
        /// 按条件查询结果集
        /// </summary>
        /// <param name="condition">条件</param>
        /// <param name="orderBy">排序条件</param>
        /// <param name="includeLogicDelete">是否包含逻辑删除的数据</param>
        /// <returns>返回的结果集</returns>
        public IList <TEntity> Query(ICondition condition, OrderByGroup orderBy, bool includeLogicDelete)
        {
            IConditionGroup group = RepositoryHelper.ToConditionGroup(condition);

            if (!includeLogicDelete)
            {
                group = group.Add(isLogicDeleteCondition);
            }
            return
                (session.CreateQuery(string.Format("FROM {0} WHERE {1} ORDER BY {2}", entityType.Name, group.ToHql(),
                                                   orderBy.ToHql())).List <TEntity>());
        }
예제 #4
0
        /// <summary>
        /// 分布查询
        /// </summary>
        /// <param name="condition">查询条件</param>
        /// <param name="orderBy">排序条件</param>
        /// <param name="includeLogicDelete">是否包含逻辑删除数据</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="pageNum">页码</param>
        /// <returns></returns>
        public IList <TEntity> QueryPage(ICondition condition, OrderByGroup orderBy, bool includeLogicDelete,
                                         int pageSize, int pageNum)
        {
            IConditionGroup group = RepositoryHelper.ToConditionGroup(condition);

            if (!includeLogicDelete)
            {
                group = group.Add(isLogicDeleteCondition);
            }
            return
                (session.CreateQuery(string.Format("FROM {0} WHERE {1} ORDER BY {2}", entityType.Name, group.ToHql(),
                                                   orderBy.ToHql())).SetFirstResult((pageNum - 1) * pageSize).SetMaxResults
                     (pageSize).List <TEntity>());
        }