From cbd35d44ffa5866847f41a3783d107d8543d6c5c Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 21 Jun 2022 13:16:28 +0800 Subject: [PATCH] Update json 2 sql --- .../SqlSugar/Json2Sql/JsonToModel/JsonSqlFuncToParameters.cs | 2 +- .../SqlSugar/Json2Sql/JsonToModel/JsonToGroupByModels.cs | 2 +- Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToJoinModels.cs | 4 ++-- .../SqlSugar/Json2Sql/JsonToModel/JsonToOrderByModels.cs | 2 +- .../SqlSugar/Json2Sql/JsonToModel/JsonToSelectModels.cs | 2 +- .../Json2Sql/Provider/Deleteable/JsonDeleteableProvider.cs | 2 +- .../SqlSugar/Json2Sql/Provider/Insertable/AppendName.cs | 2 +- .../SqlSugar/Json2Sql/Provider/Queryable/AppendFrom.cs | 1 + .../SqlSugar/Json2Sql/Provider/Updateable/AppendTable.cs | 2 +- 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonSqlFuncToParameters.cs b/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonSqlFuncToParameters.cs index 6186f689c..6ebeb7880 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonSqlFuncToParameters.cs +++ b/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonSqlFuncToParameters.cs @@ -57,7 +57,7 @@ namespace SqlSugar public object GetStringParameters(JToken parameters) { - return parameters.ObjToString(); + return parameters.ObjToString().ToCheckField(); } #endregion diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToGroupByModels.cs b/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToGroupByModels.cs index 4f0ccbbe8..b09817eb7 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToGroupByModels.cs +++ b/Src/Asp.Net/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; diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToJoinModels.cs b/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToJoinModels.cs index 7ebb17e1f..705c10a44 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToJoinModels.cs +++ b/Src/Asp.Net/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; } diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToOrderByModels.cs b/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToOrderByModels.cs index d25f3f927..5eeed2ea3 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToOrderByModels.cs +++ b/Src/Asp.Net/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) { diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToSelectModels.cs b/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToSelectModels.cs index b8a78db4e..fbd74147b 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/JsonToModel/JsonToSelectModels.cs +++ b/Src/Asp.Net/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)) { diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Deleteable/JsonDeleteableProvider.cs b/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Deleteable/JsonDeleteableProvider.cs index ba074e47c..cc30018ea 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Deleteable/JsonDeleteableProvider.cs +++ b/Src/Asp.Net/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; diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Insertable/AppendName.cs b/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Insertable/AppendName.cs index 4e94e2bc9..a765fad78 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Insertable/AppendName.cs +++ b/Src/Asp.Net/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; diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Queryable/AppendFrom.cs b/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Queryable/AppendFrom.cs index b42984391..9a0e4fdf4 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Queryable/AppendFrom.cs +++ b/Src/Asp.Net/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()) { diff --git a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Updateable/AppendTable.cs b/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Updateable/AppendTable.cs index b4ee58609..d8f13be0d 100644 --- a/Src/Asp.Net/SqlSugar/Json2Sql/Provider/Updateable/AppendTable.cs +++ b/Src/Asp.Net/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;