Browse Source

Update jon 2 sql bug

SqlSugar5
sunkaixuan 2 years ago
parent
commit
411f58e701
  1. 25
      Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Queryable/AppendJoin.cs

25
Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Queryable/AppendJoin.cs

@ -16,12 +16,33 @@ namespace SqlSugar
bool isJoin = true;
var value = item.First().ToString();
var obj = context.Utilities.JsonToJoinModels(value);
sugarQueryable.AddJoinInfo(obj.TableName, obj.ShortName, obj.OnWhereList, obj.JoinType);
AddTableInfos(obj.TableName,obj.ShortName);
sugarQueryable.AddJoinInfo(obj.TableName, obj.ShortName, obj.OnWhereList, GetJoinType(item));
AddTableInfos(obj.TableName, obj.ShortName);
AfterJoin();
return isJoin;
}
private static JoinType GetJoinType(JToken obj)
{
var key = obj.Path.ToLower();
if (key.Contains("right"))
{
return JoinType.Right;
}
else if (key.Contains("left"))
{
return JoinType.Left;
}
else if (key.Contains("full"))
{
return JoinType.Full;
}
else
{
return JoinType.Inner;
}
}
private void AfterJoin()
{

Loading…
Cancel
Save