예제 #1
0
        public override DBTablePage GetPage(DBTablePage page)
        {
            dynamic rows = DB.Query(
                "select *" +
                $" from {Name}" +
                (string.IsNullOrEmpty(page.OrderBy)
                    ? string.Empty
                    : $" order by {page.OrderBy} { (string.IsNullOrEmpty(page.OrderDir) ? "asc" : page.OrderDir) }") +
                $" limit {page.PageSize} offset {(page.Page - 1) * page.PageSize}");

            decimal count = Count;

            return(new DBTablePage {
                Total = count,
                Page = page.Page,
                PageSize = page.PageSize,
                PageCount = (int)Math.Ceiling(count / page.PageSize),
                OrderBy = page.OrderBy,
                OrderDir = page.OrderDir,
                Rows = rows
            });
        }
예제 #2
0
 public virtual DBTablePage GetPage(DBTablePage page)
 {
     return(null);
 }