//获取页面所有的查询条件
protected string[] GetSearchList()
{
List<string> listSearcher = new List<string>();
listSearcher.Add(this.txtGH.Text.Trim());
listSearcher.Add(this.txtName.Text.Trim());
listSearcher.Add(this.DP_Dep.SelectedValue);
return listSearcher.ToArray();
}
//组合查询
public DataSet GetEmployerinfo(string[] searchArr)
{
StringBuilder strSql = new StringBuilder();
List<OracleParameter> parameterList = new List<OracleParameter>();
strSql.AppendLine(" select e.gh,e.xm,e.bmh from table t ");
strSql.AppendLine(" right join fin_employerinfo e on t.gh = e.gh ");
strSql.AppendLine(" left join erp_department d on e.bmh = d.depid ");
strSql.AppendLine(" where 1=1");
if (searchArr.Length != 0)
{
if (searchArr[0] != "")
{
strSql.AppendLine(" and e.gh like :gh");
parameterList.Add(new OracleParameter(":gh", "%" + searchArr[0] + "%"));
}
if (searchArr[1] != "")
{
strSql.AppendLine(" and e.xm like :xm");
parameterList.Add(new OracleParameter(":xm", "%" + searchArr[1] + "%"));
}
if (searchArr[2] != "" && searchArr[2] != "0")
{
strSql.AppendLine(" and e.bmh=:bmh");
parameterList.Add(new OracleParameter(":bmh", searchArr[2]));
}
}
strSql.AppendLine(" order by e.gh asc");
return DbHelperOra.Query(strSql.ToString(), parameterList.ToArray());
}
//调用
GetEmployerinfo(GetSearchList());
筛选器
最新推荐文章于 2024-07-23 20:57:38 发布