/// <summary> /// 获取排序sql语句 /// </summary> /// <returns></returns> public string GetOrderBySql() { if (string.IsNullOrWhiteSpace(SortBy)) { return(""); } var resultSql = new StringBuilder(" ORDER BY "); string dir = Direction; if (string.IsNullOrWhiteSpace(dir)) { dir = "ASC"; } if (SortBy.Contains("&")) { resultSql.Append("").Append(string.Join(",", SortBy.Split('&').Select(e => $" {e} {dir}").ToArray())); } else { resultSql.Append(SortBy).Append("").Append(dir);//默认处理方式 } return(resultSql.ToString()); }