All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.cliveyuan.robin.base.condition.PageQueryExample Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
/*
 * Copyright (c) 2020  Clive Yuan ([email protected]).
 */

package cn.cliveyuan.robin.base.condition;

import cn.cliveyuan.robin.base.common.PageQueryRequest;
import cn.cliveyuan.robin.base.util.BeanCopyUtils;

import java.util.Objects;

/**
 * 分页查询示例
 *
 * @author Clive Yuan
 * @date 2020/10/30
 */
public class PageQueryExample extends QueryExample {
    /**
     * 默认页码
     */
    public static final int DEFAULT_PAGE_NO = 1;

    /**
     * 默认分页大小
     */
    public static final int DEFAULT_PAGE_SIZE = 10;

    /**
     * 页号 (默认1)
     */
    private Integer pageNo = DEFAULT_PAGE_NO;

    /**
     * 每页条数 (默认10)
     */
    private Integer pageSize = DEFAULT_PAGE_SIZE;

    public PageQueryExample() {
    }

    public PageQueryExample(PageQueryRequest pageQueryRequest, Class tClass) {
        if (Objects.nonNull(pageQueryRequest)) {
            this.setPageNo(pageQueryRequest.getPageNo());
            this.setPageSize(pageQueryRequest.getPageSize());
            if (pageQueryRequest.getEntity() != null) {
                this.setEntity(BeanCopyUtils.copy(pageQueryRequest.getEntity(), tClass));
            }
        }
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy