|  |  |  | 
|---|
|  |  |  | * 每页显示的记录数 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "每页记录数") | 
|---|
|  |  |  | @Builder.Default | 
|---|
|  |  |  | public Integer pageSize = 0 ; | 
|---|
|  |  |  | public Integer pageSize ; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 记录总数 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "记录总数") | 
|---|
|  |  |  | @Builder.Default | 
|---|
|  |  |  | public Long itemTotal = 0L; | 
|---|
|  |  |  | public Long itemTotal ; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 当前页 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "当前页") | 
|---|
|  |  |  | @Builder.Default | 
|---|
|  |  |  | public Integer pageCurr = 0; | 
|---|
|  |  |  | public Integer pageCurr ; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 总页数 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "总页数") | 
|---|
|  |  |  | @Builder.Default | 
|---|
|  |  |  | public Integer pageTotal = 0; | 
|---|
|  |  |  | public Integer pageTotal ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "数据") | 
|---|
|  |  |  | @Builder.Default | 
|---|
|  |  |  | public T content = null; | 
|---|
|  |  |  | public T obj; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询开始记录 | 
|---|
|  |  |  | 
|---|
|  |  |  | public void calculateAndSet(Long itemTotal, Map<String, Object> params) { | 
|---|
|  |  |  | this.itemTotal = itemTotal ; | 
|---|
|  |  |  | if(this.itemTotal == null){ | 
|---|
|  |  |  | itemTotal = 0L ; | 
|---|
|  |  |  | this.itemTotal = 0L ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (pageSize < 1) { | 
|---|
|  |  |  | pageSize = 1; | 
|---|
|  |  |  | if(this.itemTotal == 0){ | 
|---|
|  |  |  | this.pageSize = 10 ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | pageTotal = (int)Math.ceil((double)itemTotal/pageSize); | 
|---|
|  |  |  | if(this.pageSize == null || this.pageSize <= 0){ | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 朱宝民 2024-01-30 修改 | 
|---|
|  |  |  | * 未传入分页参数时,取全部记录 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | //this.pageSize = 1 ;//供下面作为除数 | 
|---|
|  |  |  | this.pageSize = 10 ;//供下面作为除数 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (pageTotal == 0) { | 
|---|
|  |  |  | pageTotal = 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageCurr < 1) { | 
|---|
|  |  |  | if (pageCurr == null || pageCurr < 1) { | 
|---|
|  |  |  | pageCurr = 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (pageCurr > pageTotal) { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.queryStart = (this.pageCurr - 1) * this.pageSize ; | 
|---|
|  |  |  | this.queryCount = this.pageSize ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | params.put("queryStart", this.queryStart) ; | 
|---|
|  |  |  | params.put("queryCount", this.queryCount) ; | 
|---|
|  |  |  | params.put("start", this.queryStart) ; | 
|---|
|  |  |  | params.put("count", this.queryCount) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|