public static string getTreeSql_all(string where1) { string wherea = ""; if (where1.Replace(@"|", "") == "") { wherea = " and 1=1"; } else { where1 = ReplaceStr.Replace(where1); string[] LvArray = where1.Split('|');//级别分割,9级 wherea = wherea + " and("; for (int i = 0; i < LvArray.Length; i++)//循环每级 { if (LvArray[i].Length > 0) { wherea = wherea + GetLevelInfo.getLevelSelect(LvArray[i]) + " or "; } } if (where1.Length > 3) { wherea = wherea.Substring(0, wherea.Length - 3) + ")"; } } return wherea; }
public static string getTreeSql_2018(string where1) { string strReturn = ""; if (!string.IsNullOrEmpty(where1)) { strReturn = " and (1=0 "; string[] strArray = where1.Split(','); for (int i = 0; i < strArray.Length; i++) { strReturn+=" or "+GetLevelInfo.GetLevelField(strArray[i].Substring(0,1))+"='"+strArray[i].Substring(1)+"'"; } strReturn += ")"; } return strReturn; }