/**
 * QueryInfo.java 
 * Copyright © 2015-2015
 * 
 * @author pengdc
 * @create 2015年7月14日
 */
package com.keao.edu.common.page;

import com.keao.edu.common.tenant.OrganContextHolder;
import com.keao.edu.common.tenant.TenantContextHolder;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * 查询对象基类
 */
public class QueryInfo {
	/**
	 * 默认当前页码
	 */
	private int page = 1;
	/**
	 * 默认页码大小
	 */
	private int rows = 20;
	/**
	 * 默认排序列
	 */
	private String sort = "create_time_";
	/**
	 * 默认排序方向
	 */
	private String order = "desc";

	private String tenantId= TenantContextHolder.getTenantId();

	private Integer organId= OrganContextHolder.getOrganId();

	private List<Integer> organIds;
	
	private String search;

	public List<Integer> getOrganIds() {
		return organIds;
	}

	public void setOrganIds(List<Integer> organIds) {
		this.organIds = organIds;
	}

	public Integer getOrganId() {
		return organId;
	}

	public void setOrganId(Integer organId) {
		this.organId = organId;
	}

	public String getTenantId() {
		return tenantId;
	}

	public String getSearch() {
		return search;
	}

	public void setSearch(String search) {
		if(StringUtils.isNotEmpty(search)){
			this.search = search;
		}
	}

	public QueryInfo(){}
	
	public QueryInfo(int page, int rows, String sort, String order) {
		super();
		this.page = page;
		this.rows = rows;
		this.sort = sort;
		this.order = order;
	}
	
	public QueryInfo(int page, int rows) {
		super();
		this.page = page;
		this.rows = rows;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getRows() {
		return rows;
	}

	public void setRows(int rows) {
		this.rows = rows;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getOrder() {
		return order;
	}

	public void setOrder(String order) {
		this.order = order;
	}
}
