package com.sinosig.core.external.filter;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import com.sinosig.util.ISearchFilter;
import com.sinosig.util.domain.DataObj;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sinosig.util.SearchContext;
import com.sinosig.util.SearchFieldFilter;
import com.sinosig.util.enums.SearchFieldType;
import com.sinosig.util.enums.SearchGroupType;
import com.sinosig.util.SearchGroupFilter;
import lombok.Data;

/**
 * 关系型数据实体[ORG] 查询条件对象
 */
@Data
public class ORGSearchContext extends SearchContext {

	   public String n_orgname_like;//[机构名称]
       public void setN_orgname_like(String n_orgname_like) {
            this.n_orgname_like=n_orgname_like;
            SearchFieldFilter searchField = new SearchFieldFilter();
            searchField.setParam("orgname");
            searchField.setCondition(SearchFieldType.LIKE);
            searchField.setValue(n_orgname_like);
            this.getCondition().add(searchField);
       }
	   public String n_porgname_eq;//[父机构名称]
       public void setN_porgname_eq(String n_porgname_eq) {
            this.n_porgname_eq=n_porgname_eq;
            SearchFieldFilter searchField = new SearchFieldFilter();
            searchField.setParam("porgname");
            searchField.setCondition(SearchFieldType.EQ);
            searchField.setValue(n_porgname_eq);
            this.getCondition().add(searchField);
       }
	   public String n_porgname_like;//[父机构名称]
       public void setN_porgname_like(String n_porgname_like) {
            this.n_porgname_like=n_porgname_like;
            SearchFieldFilter searchField = new SearchFieldFilter();
            searchField.setParam("porgname");
            searchField.setCondition(SearchFieldType.LIKE);
            searchField.setValue(n_porgname_like);
            this.getCondition().add(searchField);
       }
	   public String n_porgid_eq;//[父机构标识]
       public void setN_porgid_eq(String n_porgid_eq) {
            this.n_porgid_eq=n_porgid_eq;
            SearchFieldFilter searchField = new SearchFieldFilter();
            searchField.setParam("porgid");
            searchField.setCondition(SearchFieldType.EQ);
            searchField.setValue(n_porgid_eq);
            this.getCondition().add(searchField);
       }

	/**
	 * 启用快速搜索
	 */
	public void setQuery(String strQuery)
	{
		 this.query=strQuery;
         if(!org.springframework.util.StringUtils.isEmpty(strQuery)){
           SearchGroupFilter searchGroupFilter=new SearchGroupFilter();
           searchGroupFilter.setSearchGroupType(SearchGroupType.OR);

           SearchFieldFilter orgname=new SearchFieldFilter();
           orgname.setParam("orgname");
           orgname.setCondition(SearchFieldType.LIKE);
           orgname.setValue(strQuery);
           searchGroupFilter.getCondition().add(orgname);
        this.getCondition().add(searchGroupFilter);   

           
           
        }
	}
}
