成人黄网站A片免费观看,欧美人妻少妇精品久久黑人,国产内射999视频一区,国产成年女人毛片80S网站

Section Menu:  

數(shù)據(jù)庫分頁功能

  • 發(fā)布時(shí)間: 2020-08-03 13:57
  •    閱讀: 4122   

數(shù)據(jù)庫分頁功能


某次查詢實(shí)現(xiàn)了以下功能便可以將page_html和result返回模板作為分頁模板和分頁數(shù)據(jù)

where = '`webid`=12'  # 查詢條件
page = 2  # 調(diào)用第幾頁數(shù)據(jù)
limit = 10  # 每頁顯示多少行數(shù)據(jù)

# 問題答案列表
result = self.db.list(
    table="question_result",
    field='answer',
    where=where,
    page=page,
    limit=limit
)
if page and page > self.db.total_page:
    page = self.db.total_page
    result = self.db.list(
        table="question_result",
        field='answer',
        where=where,
        page=page,
        limit=limit
    )
from kyger.common import page_tpl
page_html = page_tpl(self.db.page, self.db.total_page, 10, self.kg['server'].get('WEB_URL'))  # 獲取分頁模板
total_rows = self.db.total_rows  # 總記錄數(shù)
total_page = self.db.total_page  # 總頁數(shù)
適應(yīng)版本
v1.0.1