skyouc
2024-12-21 c635d78b479510ebe2556a420948effcd30a0731
zy-asrs-common/src/main/java/com/zy/asrs/common/domain/param/PageParam.java
@@ -1,56 +1,56 @@
package com.zy.asrs.common.domain.param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
 * 分页、排序、搜索参数封装
 *
 * @author vincent
 * @since 2019-04-26 10:34:35
 */
public class PageParam<T, U extends BaseParam> extends Page<T> {
    private static final long serialVersionUID = 1L;
    /**
     * 租户id字段名称
     */
    private static final String TENANT_ID_FIELD = "tenantId";
    /**
     * 查询条件
     */
    private final U where;
    /**
     * 是否把字段名称驼峰转下划线
     */
    private final boolean isToUnderlineCase;
    public PageParam() {
        this(null);
    }
    public PageParam(U where) {
        this(where, true);
    }
    public PageParam(U where, boolean isToUnderlineCase) {
        super();
        this.where = where;
        this.isToUnderlineCase = isToUnderlineCase;
        if (where != null) {
            // 获取分页页码
            if (where.getCurr() != null) {
                setCurrent(where.getCurr());
            }
            // 获取分页每页数量
            if (where.getLimit() != null) {
                setSize(where.getLimit());
            }
        }
    }
}
package com.zy.asrs.common.domain.param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
 * 分页、排序、搜索参数封装
 *
 * @author vincent
 * @since 2019-04-26 10:34:35
 */
public class PageParam<T, U extends BaseParam> extends Page<T> {
    private static final long serialVersionUID = 1L;
    /**
     * 租户id字段名称
     */
    private static final String TENANT_ID_FIELD = "tenantId";
    /**
     * 查询条件
     */
    private final U where;
    /**
     * 是否把字段名称驼峰转下划线
     */
    private final boolean isToUnderlineCase;
    public PageParam() {
        this(null);
    }
    public PageParam(U where) {
        this(where, true);
    }
    public PageParam(U where, boolean isToUnderlineCase) {
        super();
        this.where = where;
        this.isToUnderlineCase = isToUnderlineCase;
        if (where != null) {
            // 获取分页页码
            if (where.getCurr() != null) {
                setCurrent(where.getCurr());
            }
            // 获取分页每页数量
            if (where.getLimit() != null) {
                setSize(where.getLimit());
            }
        }
    }
}