Update json 2 sql

This commit is contained in:
sunkaixuan 2023-11-14 12:17:44 +08:00
parent 3abcb60598
commit e991dd337b
3 changed files with 9 additions and 2 deletions

View File

@ -113,7 +113,7 @@ namespace SqlSugar
var parname = GetParameterName(pars, parvalue);
return parname;
}
private int GetParameterNameIndex = 100;
internal int GetParameterNameIndex = 100;
private string GetParameterName(List<SugarParameter> pars, object parvalue)
{

View File

@ -30,6 +30,7 @@ namespace SqlSugar
}
//public ISqlSugarClient context { get; set; }
public ISqlBuilder sqlBuilder { get; set; }
public int ParameterIndex { get { return ((SqlBuilderProvider)sqlBuilder)?.GetParameterNameIndex??0; } }
public JsonTableNameInfo GetTableName(JToken item)
{
JsonTableNameInfo jsonTableNameInfo = new JsonTableNameInfo();

View File

@ -66,6 +66,7 @@ namespace SqlSugar
private void AppendQueryableAll(JsonQueryParameter jsonQueryParameter, JToken item)
{
SetQueryableParameterIndex();
var name = item.Path.ToLower();
if (IsForm(name))
{
@ -79,7 +80,7 @@ namespace SqlSugar
{
AppendOrderBy(item);
}
else if (IsJoinLastAfter(name))
else if (IsJoinLastAfter(name))
{
ApendJoinLastAfter(item);
}
@ -108,5 +109,10 @@ namespace SqlSugar
jsonQueryParameter.IsSelect = AppendJoin(item);
}
}
private void SetQueryableParameterIndex()
{
((SqlBuilderProvider)sugarQueryable.SqlBuilder).GetParameterNameIndex = jsonCommonProvider.ParameterIndex;
}
}
}