blob: 9e8865891efdec851d710b27b18482dc1c4a6d53 [file] [log] [blame]
##
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#macro(pagination $queryResult $baseUrl)
## 页面条数
#set($pSize=$queryResult.getPageSize())
## 总页数/最后一页
#set($tPage=$queryResult.getTotalPage())
## 当前页
#set($cPage=$queryResult.getCurrentPage())
## 上一页
#set($lPage=$queryResult.getLastPage())
## 下一页
#set($nPage=$queryResult.getNextPage())
<!-- 分页 START -->
<div class="pg-wp">
<div class="pg-info">
$queryResult.getTotalCount()条记录,每页显示
<select class="min" name="" id="">
<option value="" #if(!$pSize || $pSize==10)selected#end>10</option>
<option value="" #if($pSize==20)selected#end>20</option>
<option value="" #if($pSize==50)selected#end>50</option>
<option value="" #if($pSize==100)selected#end>100</option>
<option value="" #if($pSize==200)selected#end>200</option>
<option value="" #if($pSize==500)selected#end>500</option>
</select>
</div>
<div class="pg">
<a class="first #if($cPage<=1)disabled#end" href="${baseUrl}?page_num=1&page_size=$pSize"><i
class="i-first"></i></a>
<a class="prev #if($cPage<=1)disabled#end"
href="${baseUrl}?page_num=$lPage&page_size=$pSize"><i
class="i-prev"></i></a>
<a #if($cPage==1)class="cur"#else href="${baseUrl}?page_num=1&page_size=$pSize" #end>1</a>
#if($tPage>1)
<a #if($cPage==2)class="cur"#else
href="${baseUrl}?page_num=2&page_size=$pSize" #end>2</a>
#if($lPage > 3)
<span class="dot">···</span>
#end
#if($cPage >= 2)
#if($cPage > 3)
<a href="${baseUrl}?page_num=$!lPage&page_size=$pSize">$!lPage</a>
#end
#if($cPage < $tPage)
#if($cPage > 2)
<a class="cur" href="">$!cPage</a>
#end
#if($nPage < $tPage)
<a href="${baseUrl}?page_num=$!nPage&page_size=$pSize">$!nPage</a>
#end
#end
#end
#if($nPage + 1 < $tPage)
<span class="dot">···</span>
#end
<a #if($cPage==$tPage)class="cur"#else
href="${baseUrl}?page_num=$!tPage&page_size=$pSize" #end>$!tPage</a>
#end
<a class="next #if($cPage>=$tPage)disabled#end"
href="${baseUrl}?page_num=$nPage&page_size=$pSize"><i class="i-next"></i></a>
<a class="last #if($cPage>=$tPage)disabled#end"
href="${baseUrl}?page_num=$tPage&page_size=$pSize"><i class="i-last"></i></a>
<span class="jump">
<input class="min xs" type="text" value="1">
<a href="" class="btn btn-primary min xs">跳转</a>
</span>
</div>
</div>
<!-- 分页 END -->
#end