\RG3.DO.Abstractions\Parsers\ParameterUtility.cs
/// <summary>
/// 格式化前数据替换
/// </summary>
/// <param name="sql"></param>
/// <param name="dicRawParameters"></param>
/// <returns></returns>
public static string ParseSqlBefore(string sql, Dictionary<string, object> dicRawParameters)
{
// 提取 {{_whereSqlDateId:start_date}} 添加 数字,避免全部获取
//ParseSqlBefore(sql, dicRawParameters);
StringBuilder sb = new StringBuilder(sql);
MatchCollection mcOpS = Regex.Matches(sql, "{{_whereSqlDateId:.{0,30}}", RegexOptions.IgnoreCase);
foreach (Match item in mcOpS)
{
if (item.Value == null || !item.Value.StartsWith("{{_whereSql")) continue;
string valueC = item.Value.Replace("{{", "").Replace("}}", "").Split(":")[1];
string valueF = dicRawParameters["_whereSqlDateId"].ToString().Replace("{{_filterDateCol}}", valueC);
sb.Replace(item.Value, valueF);
}
return sb.ToString();
}
文档更新时间: 2022-09-18 14:56 作者:admin