zoukankan      html  css  js  c++  java
  • 分页类

    package com.zhanggaosong.pro.utils;

    public class PageModel {

    private int pageSize;// 页面容量

    private int pageCurrent;// 当前页面编号

    private int pageTotal;// 总页数

    private int recordTotal;// 总的记录数

    public int getPageSize() {
    return pageSize;
    }

    public void setPageSize(int pageSize) {
    this.pageSize = pageSize;
    }

    public int getPageCurrent() {
    return pageCurrent;
    }

    public void setPageCurrent(int pageCurrent) {
    this.pageCurrent = pageCurrent;
    }

    public int getPageTotal() {
    return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
    this.pageTotal = pageTotal;
    }

    public int getRecordTotal() {
    return recordTotal;
    }

    public void setRecordTotal(int recordTotal) {
    this.recordTotal = recordTotal;
    }

    /**
    * pageCurrent:从页面传递过来的页面编号 recordTotal:从数据库中查询出的总记录数
    * pageSize:在每个模块中根据需求对其赋值 以下这个方法对上述的属性进行服务器端的处理
    */
    public PageModel getPageModel(String pageCurrent, int recordTotal,
    int pageSize) {


    //对pageSize 赋值
    this.pageSize=pageSize;
    //对recordTotal赋值
    this.recordTotal=recordTotal;

    //设置总页数(算法)
    if(this.recordTotal%this.pageSize==0)
    {
    this.pageTotal=this.recordTotal/this.pageSize;
    }else{
    this.pageTotal=this.recordTotal/this.pageSize+1;
    }


    //设置当前页码对pageCurrent赋值
    try {
    this.pageCurrent = Integer.valueOf(pageCurrent);
    } catch (Exception e) {

    this.pageCurrent = 1;
    }
    //判断页面编号的上限
    if(this.pageCurrent<1){
    this.pageCurrent=1;

    }
    //根据总页数去判断当前的页码的下限
    if(this.pageCurrent>this.pageTotal){
    this.pageCurrent=this.pageTotal;

    }

    return this;
    }

    }

  • 相关阅读:
    linux设备模型
    dma
    POSIX thread
    Network: IP QoS
    TCP: sliding window of flow control
    TCPIP: UDP/TCP checksum
    Hebrew: Learning Resources
    Vivado: Uninstall Vivado on ubuntu/linux
    HLS: vivado_hls compile fail, csim and csyn error, no ip generated for udpLoopback and toe
    HLS: High-Level Synthesis Operators
  • 原文地址:https://www.cnblogs.com/zhanggaosong/p/2958974.html
Copyright © 2011-2022 走看看