package com.sa.ibiz.demo.demo.service.dto;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sa.ibiz.demo.ibizutil.domain.ParentData;
import com.sa.ibiz.demo.demo.domain.WFUserAssist;
import org.springframework.util.StringUtils;
import lombok.Data;
import java.util.Map;
import java.sql.Timestamp;
import com.sa.ibiz.demo.ibizutil.service.SearchFilterBase;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sa.ibiz.demo.ibizutil.helper.DataGridCustomSearchHelper;
import com.alibaba.fastjson.JSONObject;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class WFUserAssistSearchFilter extends SearchFilterBase {

	private String query;
	private Page page;
	private QueryWrapper<WFUserAssist> selectCond;
	private JSONObject customsearchval;
	public WFUserAssistSearchFilter(){
		this.page =new Page<WFUserAssist>(1,Short.MAX_VALUE);
		this.selectCond=new QueryWrapper<WFUserAssist>();	
	}

	/**
	 * 设定自定义查询条件，在原有SQL基础上追加该SQL
	 */
	public void setCustomCond(String sql)
	{
		this.selectCond.apply(sql);
	}

	private String n_wfmajoruserid_eq;

	public void setN_wfmajoruserid_eq(String n_wfmajoruserid_eq) {
        this.n_wfmajoruserid_eq = n_wfmajoruserid_eq;
        if(!StringUtils.isEmpty(this.n_wfmajoruserid_eq)){
            this.selectCond.eq("wfmajoruserid", n_wfmajoruserid_eq);
        }
    }
	private String n_wfmajorusername_eq;

	public void setN_wfmajorusername_eq(String n_wfmajorusername_eq) {
        this.n_wfmajorusername_eq = n_wfmajorusername_eq;
        if(!StringUtils.isEmpty(this.n_wfmajorusername_eq)){
            this.selectCond.eq("wfmajorusername", n_wfmajorusername_eq);
        }
    }
	private String n_wfmajorusername_like;

	public void setN_wfmajorusername_like(String n_wfmajorusername_like) {
        this.n_wfmajorusername_like = n_wfmajorusername_like;
        if(!StringUtils.isEmpty(this.n_wfmajorusername_like)){
            this.selectCond.like("wfmajorusername", n_wfmajorusername_like);
        }
    }
	private String n_wfminoruserid_eq;

	public void setN_wfminoruserid_eq(String n_wfminoruserid_eq) {
        this.n_wfminoruserid_eq = n_wfminoruserid_eq;
        if(!StringUtils.isEmpty(this.n_wfminoruserid_eq)){
            this.selectCond.eq("wfminoruserid", n_wfminoruserid_eq);
        }
    }
	private String n_wfminorusername_eq;

	public void setN_wfminorusername_eq(String n_wfminorusername_eq) {
        this.n_wfminorusername_eq = n_wfminorusername_eq;
        if(!StringUtils.isEmpty(this.n_wfminorusername_eq)){
            this.selectCond.eq("wfminorusername", n_wfminorusername_eq);
        }
    }
	private String n_wfminorusername_like;

	public void setN_wfminorusername_like(String n_wfminorusername_like) {
        this.n_wfminorusername_like = n_wfminorusername_like;
        if(!StringUtils.isEmpty(this.n_wfminorusername_like)){
            this.selectCond.like("wfminorusername", n_wfminorusername_like);
        }
    }
	private String n_wfuserassistname_like;

	public void setN_wfuserassistname_like(String n_wfuserassistname_like) {
        this.n_wfuserassistname_like = n_wfuserassistname_like;
        if(!StringUtils.isEmpty(this.n_wfuserassistname_like)){
            this.selectCond.like("wfuserassistname", n_wfuserassistname_like);
        }
    }
	private String n_wfworkflowid_eq;

	public void setN_wfworkflowid_eq(String n_wfworkflowid_eq) {
        this.n_wfworkflowid_eq = n_wfworkflowid_eq;
        if(!StringUtils.isEmpty(this.n_wfworkflowid_eq)){
            this.selectCond.eq("wfworkflowid", n_wfworkflowid_eq);
        }
    }
	private String n_wfworkflowname_eq;

	public void setN_wfworkflowname_eq(String n_wfworkflowname_eq) {
        this.n_wfworkflowname_eq = n_wfworkflowname_eq;
        if(!StringUtils.isEmpty(this.n_wfworkflowname_eq)){
            this.selectCond.eq("wfworkflowname", n_wfworkflowname_eq);
        }
    }
	private String n_wfworkflowname_like;

	public void setN_wfworkflowname_like(String n_wfworkflowname_like) {
        this.n_wfworkflowname_like = n_wfworkflowname_like;
        if(!StringUtils.isEmpty(this.n_wfworkflowname_like)){
            this.selectCond.like("wfworkflowname", n_wfworkflowname_like);
        }
    }

	public void setSrfparentdata(Map<String, String> srfparentdata) {
		this.srfparentdata = srfparentdata;
		String strParentkey=this.getSrfparentdata().get("srfparentkey");
		if(this.srfparentdata.containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_WFUSERASSIST_WFUSER_WFMAJORUSERID"))
			if(StringUtils.isEmpty(strParentkey)){
				this.setN_wfmajoruserid_eq("NA");
			}
			else{
				this.setN_wfmajoruserid_eq(strParentkey);
			}
		if(this.srfparentdata.containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_WFUSERASSIST_WFUSER_WFMINORUSERID"))
			if(StringUtils.isEmpty(strParentkey)){
				this.setN_wfminoruserid_eq("NA");
			}
			else{
				this.setN_wfminoruserid_eq(strParentkey);
			}
		if(this.srfparentdata.containsKey("srfparentmode")&& this.getSrfparentdata().get("srfparentmode").equals("DER1N_WFUSERASSIST_WFWORKFLOW_WFWORKFLOWID"))
			if(StringUtils.isEmpty(strParentkey)){
				this.setN_wfworkflowid_eq("NA");
			}
			else{
				this.setN_wfworkflowid_eq(strParentkey);
			}
	}

	/**
	 * 启用快速搜索
	 */
	public void setQuery(String query)
	{
		 this.query=query;
		 if(!StringUtils.isEmpty(query)){
			this.selectCond.or().like("wfuserassistname",query);
		 }
	}

	/**
	 * 自定义查询
	 * @param customsearchval
	 */
	public void setCustomsearchval(JSONObject customsearchval) {
		this.customsearchval = customsearchval;
		if(!StringUtils.isEmpty(customsearchval)){
			DataGridCustomSearchHelper customSearchHelper= DataGridCustomSearchHelper.getInstance();
			String customSql =customSearchHelper.parseCustomVal(customsearchval);
			this.selectCond.apply(customSql);
		}
	}

}