Update select new json

This commit is contained in:
sunkaixuan 2024-04-16 12:51:26 +08:00
parent c06a06ab32
commit e9f9b7218d

View File

@ -667,7 +667,7 @@ namespace SqlSugar
if (mappingKeys != null && mappingKeys.ContainsKey(item.Name))
{
var key = mappingKeys[item.Name];
Json(readerValues, result, name, typeName, key);
Json(readerValues, result, name, typeName, key,item);
}
else
{
@ -759,7 +759,7 @@ namespace SqlSugar
return result;
}
private void Json(Dictionary<string, object> readerValues, Dictionary<string, object> result, string name, string typeName, string shortName = null)
private void Json(Dictionary<string, object> readerValues, Dictionary<string, object> result, string name, string typeName, string shortName = null,PropertyInfo item=null)
{
var key = (typeName + "." + name).ToLower();
if (readerValues.Any(it => it.Key.EqualCase(key)))
@ -775,6 +775,15 @@ namespace SqlSugar
var jsonString = readerValues.First(it => it.Key.EqualCase(key)).Value;
AddJson(result, name, jsonString);
}
else if (item != null)
{
if (readerValues.Any(it => it.Key.EqualCase(item.Name + "." + name)))
{
var jsonString = readerValues.First(it => it.Key.EqualCase(item.Name + "." + name)).Value;
AddJson(result, name, jsonString);
}
}
}
}
private void Json(Dictionary<string, object> readerValues, Dictionary<string, object> result, string name, string typeName, PropertyInfo item)