Browse Source

Update json 2 sql

pull/19/head
sunkaixuan 2 years ago
parent
commit
8af04193fc
  1. 4
      Src/Asp.NetCore2/SqlSugar/Abstract/SaveableProvider/Storageable.cs
  2. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonSqlFuncToParameters.cs
  3. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToGroupByModels.cs
  4. 4
      Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToJoinModels.cs
  5. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToOrderByModels.cs
  6. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToSelectModels.cs
  7. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Deleteable/JsonDeleteableProvider.cs
  8. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Insertable/AppendName.cs
  9. 1
      Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Queryable/AppendFrom.cs
  10. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Queryable/AppendPage.cs
  11. 2
      Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Updateable/AppendTable.cs

4
Src/Asp.NetCore2/SqlSugar/Abstract/SaveableProvider/Storageable.cs

@ -73,7 +73,9 @@ namespace SqlSugar
var result = 0;
var x = this.ToStorage();
result+=x.AsInsertable.ExecuteCommand();
result += x.AsUpdateable.ExecuteCommand();
var updateRow = x.AsUpdateable.ExecuteCommand();
if (updateRow < 0) updateRow = 0;
result += updateRow;
return result;
}
public async Task<int> ExecuteCommandAsync()

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonSqlFuncToParameters.cs

@ -57,7 +57,7 @@ namespace SqlSugar
public object GetStringParameters(JToken parameters)
{
return parameters.ObjToString();
return parameters.ObjToString().ToCheckField();
}
#endregion

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToGroupByModels.cs

@ -22,7 +22,7 @@ namespace SqlSugar
}
else
{
conditionalModels.Add(new GroupByModel() { FieldName = item.ObjToString() });
conditionalModels.Add(new GroupByModel() { FieldName = item.ObjToString().ToCheckField() });
}
}
return conditionalModels;

4
Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToJoinModels.cs

@ -22,8 +22,8 @@ namespace SqlSugar
var shortName = array[1];
var onWhere = array[2];
JoinModel result = new JoinModel();
result.TableName = tableName.ObjToString();
result.ShortName = shortName.ObjToString();
result.TableName = tableName.ObjToString().ToCheckField();
result.ShortName = shortName.ObjToString().ToCheckField();
result.OnWhereList = JsonToSqlFuncModels(onWhere);
return result;
}

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToOrderByModels.cs

@ -22,7 +22,7 @@ namespace SqlSugar
}
else if (item.Type == JTokenType.String)
{
conditionalModels.Add(new OrderByModel() { FieldName = item.ObjToString() });
conditionalModels.Add(new OrderByModel() { FieldName = item.ObjToString().ToCheckField() });
}
else if (item.Type == JTokenType.Array)
{

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/JsonToModel/JsonToSelectModels.cs

@ -22,7 +22,7 @@ namespace SqlSugar
}
else if (IsString(item))
{
conditionalModels.Add(new SelectModel() { FiledName = item.ObjToString(), AsName = item.ObjToString().Replace(".", "_") });
conditionalModels.Add(new SelectModel() { FiledName = item.ObjToString().ToCheckField(), AsName = item.ObjToString().Replace(".", "_") });
}
else if (IsArraySingleItem(item))
{

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Deleteable/JsonDeleteableProvider.cs

@ -50,7 +50,7 @@ namespace SqlSugar
private void AppendTable(JToken item)
{
var tableInfo = jsonCommonProvider.GetTableName(item);
var tableName = tableInfo.TableName;
var tableName = tableInfo.TableName.ToCheckField();
if (tableInfo.ShortName.HasValue())
{
tableName = tableInfo.ShortName + "." + tableInfo.TableName;

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Insertable/AppendName.cs

@ -10,7 +10,7 @@ namespace SqlSugar
private void AppendName(JToken item)
{
var tableInfo = jsonCommonProvider.GetTableName(item);
this.TableName = tableInfo.TableName;
this.TableName = tableInfo.TableName.ToCheckField();
if (tableInfo.ShortName.HasValue())
{
this.TableName = tableInfo.ShortName + "." + tableInfo.TableName;

1
Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Queryable/AppendFrom.cs

@ -15,6 +15,7 @@ namespace SqlSugar
private void AppendFrom(JToken item)
{
var tableNameInfo=jsonCommonProvider.GetTableName(item);
tableNameInfo.TableName.ToCheckField();
AddMasterTableInfos(tableNameInfo);
if (tableNameInfo.ShortName.HasValue())
{

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Queryable/AppendPage.cs

@ -17,7 +17,7 @@ namespace SqlSugar
private int AppendPageNumber(JToken item)
{
var result= Convert.ToInt32(item.First().ToString().ObjToInt());
var result = Convert.ToInt32(item.First().ToString().ObjToInt());
if (result == 0)
{
result = 1;

2
Src/Asp.NetCore2/SqlSugar/Json2Sql/Provider/Updateable/AppendTable.cs

@ -11,7 +11,7 @@ namespace SqlSugar
private void AppendTable(JToken item)
{
var tableInfo = jsonCommonProvider.GetTableName(item);
this.TableName = tableInfo.TableName;
this.TableName = tableInfo.TableName.ToCheckField();
if (tableInfo.ShortName.HasValue())
{
this.TableName = tableInfo.ShortName + "." + tableInfo.TableName;

Loading…
Cancel
Save