spring-boot修改mybatisPlus的分页插件的size,current,to。。。
前⼏天项⽬中需要对分页插件返回的size,current,total这3个参数的名称进⾏修改,在⽹上了半年都没有,只好⾃⼰解决了。
⾸先分页插件肯定是⼀个⼯具类,所有就想着能不能看下有他⾃带的⽅法去修改这3个属性,但是⼤家都知道,set get⽅法只能修改他们的值,不能修改他们本⾝的名称。
后来⼜想着看能不能去这个⼯具类⾥⾯去修改,但是不知道为什么分页插件的这个类只是可读的,不能够对他进⾏修改。
所有最后实在没办法了,就写了⼀个⼯具类去继承,除了这3个属性名称不⼀样,其他⽅法都是⼀样的,然后在使⽤分页插件的时候,就引⼊这个类!
package com.loogearmons.util;
import adata.OrderItem;
import lkit.CollectionUtils;
import sion.plugins.pagination.Page;
import java.util.*;
import java.util.function.Predicate;
public class PageHelp extends Page {
private static final long serialVersionUID = 8545996863226528798L;
protected List records;
protected long totalCount;
protected long pageNum;
protected long pageSize;
protected List orders;
protected boolean optimizeCountSql;
protected boolean isSearchCount;
protected boolean hitCount;
protected String countId;
protected Long maxLimit;
public  PageHelp() {
this.pageSize = 10L;
this.pageNum = 1L;
this.optimizeCountSql = true;
this.isSearchCount = true;
this.hitCount = false;
super.current=this.pageNum;
super.size=this.pageSize;
}
public PageHelp(long pageNum, long pageSize) {
this(pageNum, pageSize, 0L);
}
public PageHelp(long pageNum, long pageSize, long totalCount) {
this(pageNum, pageSize, totalCount, true);
}
public PageHelp(long pageNum, long pageSize, boolean isSearchCount) {
this(pageNum, pageSize, 0L, isSearchCount);
}
public PageHelp(long pageNum, long pageSize, long totalCount, boolean isSearchCount) {
this.pageSize = 10L;
this.pageNum = 1L;
this.optimizeCountSql = true;
this.isSearchCount = true;
this.hitCount = false;
if (pageNum > 1L) {
this.pageNum = pageNum;
}
this.pageSize = pageSize;
this.isSearchCount = isSearchCount;
}
public boolean hasPrevious() {
return this.pageNum > 1L;
}
public boolean hasNext() {
return this.pageNum < Pages();
}
public List<T> getRecords() {
ds;
}
public Page<T> setRecords(List<T> records) {    ds = records;
return this;
}
public long getTotal() {
alCount;
}
public Page<T> setTotal(long totalCount) {
return this;
}
public long getSize() {
return this.pageSize;
}
public Page<T> setSize(long pageSize) {
this.pageSize = pageSize;
return this;
}
public long getCurrent() {
return this.pageNum;
}
public Page<T> setCurrent(long pageSize) {    this.pageSize = pageSize;
return this;
}
public String countId() {
CountId();
}
public Long maxLimit() {
MaxLimit();
}
private String[] mapOrderToArray(Predicate<OrderItem> filter) {
List<String> columns = new ders.size());
if (st(i)) {
columns.Column());
}
});
return (String[])Array(new String[0]);
}
private void removeOrder(Predicate<OrderItem> filter) {
for(int i = ders.size() - 1; i >= 0; --i) {
if ((i))) {
}
}
}
public Page<T> items) {
return this;
}
public Page<T> addOrder(List<OrderItem> items) {
return this;
}
/** @deprecated */
@Deprecated
public Page<T> setAscs(List<String> ascs) {
return CollectionUtils.isNotEmpty(ascs) ? this.setAsc((String[])Array(new String[0])) : this; }
/** @deprecated */
@Deprecated
public Page<T> ascs) {
String[] var2 = ascs;
int var3 = ascs.length;
for(int var4 = 0; var4 < var3; ++var4) {
String s = var2[var4];
this.addOrder(OrderItem.asc(s));
}
return this;
}
/** @deprecated */
分页查询插件@Deprecated
public Page<T> setDescs(List<String> descs) {
if (CollectionUtils.isNotEmpty(descs)) {
return !item.isAsc();
});
Iterator var2 = descs.iterator();
while(var2.hasNext()) {
String s = (();
this.addOrder(OrderItem.desc(s));
}
}
return this;
}
/** @deprecated */
@Deprecated
public Page<T> descs) {
this.setDescs(Arrays.asList(descs));
return this;
}
public List<OrderItem> orders() {
Orders();
}
public boolean optimizeCountSql() {
return this.optimizeCountSql;
}
public boolean isOptimizeCountSql() {
return this.optimizeCountSql();
}
public boolean isSearchCount() {
al < 0L ? false : this.isSearchCount;
}
public Page<T> setSearchCount(boolean isSearchCount) {
this.isSearchCount = isSearchCount;
return this;
}
public Page<T> setOptimizeCountSql(boolean optimizeCountSql) {    this.optimizeCountSql = optimizeCountSql;
return this;
}
public void hitCount(boolean hit) {
this.hitCount = hit;
}
public void setHitCount(boolean hit) {
this.hitCount = hit;
}
public boolean isHitCount() {
return this.hitCount;
}
public List<OrderItem> getOrders() {
ders;
}
public void setOrders(final List<OrderItem> orders) {
}
public String getCountId() {
untId;
}
public void setCountId(final String countId) {
}
public Long getMaxLimit() {
return this.maxLimit;
}
public void setMaxLimit(final Long maxLimit) {    this.maxLimit = maxLimit;
}
public long getTotalCount() {
return totalCount;
}
public void setTotalCount(long totalCount) {    alCount = totalCount;
}
public long getPageNum() {
return pageNum;
}
public void setPageNum(long pageNum) {
this.pageNum = pageNum;
}
public long getPageSize() {
return pageSize;
}
public void setPageSize(long pageSize) {
this.pageSize = pageSize;
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。