Пример #1
0
 /// <summary>
 /// 分页查询
 /// </summary>
 /// <param name="filter">查询参数</param>
 /// <returns>分页</returns>
 /// <remarks>2014-03-31 朱家宏 创建</remarks>
 public Pager <DsDealerLog> GetPagerList(ParaDsDealerLogFilter filter)
 {
     return(IDsDealerLog.Instance.Query(filter));
 }
Пример #2
0
 /// <summary>
 /// 分页查询
 /// </summary>
 /// <param name="filter">查询参数</param>
 /// <returns>分页</returns>
 /// <remarks>2014-03-31 朱家宏 创建</remarks>
 public abstract Pager <DsDealerLog> Query(ParaDsDealerLogFilter filter);
Пример #3
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="filter">查询参数</param>
        /// <returns>分页</returns>
        /// <remarks>2014-03-31 朱家宏 创建</remarks>
        public override Pager <DsDealerLog> Query(ParaDsDealerLogFilter filter)
        {
            string sql = @"DsDealerLog a where {0} ";

            #region 构造sql

            var paras = new ArrayList();
            var where = "1=1 ";
            int i = 0;
            if (!string.IsNullOrWhiteSpace(filter.MallOrderId))
            {
                where += " and a.MallOrderID=@p0p" + i;
                paras.Add(filter.MallOrderId);
                i++;
            }
            if (filter.BeginDate.HasValue)
            {
                where += " and a.CreatedDate>=@p0p" + i;
                paras.Add(filter.BeginDate);
                i++;
            }
            if (filter.EndDate.HasValue)
            {
                where += " and a.CreatedDate<@p0p" + i;
                paras.Add(filter.EndDate);
                i++;
            }
            if (filter.OrderSysNo != null)
            {
                where += " and a.SoOrderSysNo=@p0p" + i;
                paras.Add(filter.OrderSysNo);
                i++;
            }
            if (filter.MallTypeSysNo > 0)
            {
                where += " and a.MallTypeSysNo=@p0p" + i;
                paras.Add(filter.MallTypeSysNo.ToString());
                i++;
            }
            if (filter.Status > 0)
            {
                where += " and a.Status=@p0p" + i;
                paras.Add(filter.Status.ToString());
                i++;
            }
            sql = string.Format(sql, where);

            #endregion

            var dataList  = Context.Select <DsDealerLog>("a.*").From(sql);
            var dataCount = Context.Select <int>("count(0)").From(sql);

            dataList.Parameters(paras);
            dataCount.Parameters(paras);

            var pager = new Pager <DsDealerLog>
            {
                PageSize    = filter.PageSize,
                CurrentPage = filter.Id,
                TotalRows   = dataCount.QuerySingle(),
                Rows        = dataList.OrderBy("a.sysNo desc").Paging(filter.Id, filter.PageSize).QueryMany()
            };

            return(pager);
        }