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

dream.first.core.queryinfo.QueryInfo Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
/**
 * 
 */
package dream.first.core.queryinfo;

import java.util.ArrayList;
import java.util.List;

import dream.first.core.queryinfo.filter.QueryFilterInfo;
import dream.first.core.queryinfo.sort.QuerySortInfo;

/**
 * 查询信息 与前端交互的一个POJO
 * 
 * @since 1.0.0
 */
public class QueryInfo {

	private Integer pageNum;

	private Integer pageSize;

	private List filters = new ArrayList();

	private List sorters = new ArrayList();

	public Integer getPageNum() {
		return pageNum;
	}

	public void setPageNum(Integer pageNum) {
		this.pageNum = pageNum;
	}

	public Integer getPageSize() {
		return pageSize;
	}

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

	public List getFilters() {
		return filters;
	}

	public void setFilters(List filters) {
		this.filters = filters;
	}

	public List getSorters() {
		return sorters;
	}

	/**
	 * 是否存在条件
	 * 
	 * @return true 存在条件
	 */
	public boolean isFilter() {
		return null != filters && !filters.isEmpty();
	}

	/**
	 * 设置排序信息。这会覆盖原有的排序信息
	 * 
	 * @param sorters 排序集合
	 */
	public void setSorters(List sorters) {
		this.sorters = sorters;
	}

	/**
	 * 是否存在排序
	 * 
	 * @return true存在排序
	 */
	public boolean isSort() {
		return null != sorters && !sorters.isEmpty();
	}

	/**
	 * 添加一个排序
	 * 
	 * @param querySortInfo 排序信息
	 */
	public void addSort(QuerySortInfo querySortInfo) {
		this.sorters.add(querySortInfo);
	}

	/**
	 * 添加一个排序
	 * 
	 * @param sortField 排序字段
	 * @param direction 排序方向
	 */
	public void addSort(String sortField, String direction) {
		this.sorters.add(new QuerySortInfo(sortField, direction));
	}

	/**
	 * 添加一个排序条件
	 * 
	 * @param queryFilterInfo 条件信息
	 */
	public void addFilter(QueryFilterInfo queryFilterInfo) {
		this.filters.add(queryFilterInfo);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy