Skip to content

Commit

Permalink
Synchronization code
Browse files Browse the repository at this point in the history
  • Loading branch information
DotNetNext committed Nov 2, 2023
1 parent 20782a9 commit d8abcc1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ namespace SqlSugar
{
public class SelectModel
{
public object FiledName { get; set; }
public object FieldName { get; set; }

[Obsolete("名字拼错使用FieldName")]
public object FiledName { get { return FieldName; } set { FieldName = value; } }

public string AsName { get; set; }

public static List<SelectModel> Create(params SelectModel[] SelectModels)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public List<SelectModel> JsonToSelectModels(string json)
}
else if (IsString(item))
{
conditionalModels.Add(new SelectModel() { FiledName = item.ObjToString().ToCheckField(), AsName = item.ObjToString().Replace(".", "_") });
conditionalModels.Add(new SelectModel() { FieldName = item.ObjToString().ToCheckField(), AsName = item.ObjToString().Replace(".", "_") });
}
else if (IsArraySingleItem(item))
{
Expand All @@ -34,7 +34,7 @@ public List<SelectModel> JsonToSelectModels(string json)
}
conditionalModels.Add(new SelectModel()
{
FiledName = fileName,
FieldName = fileName,
AsName = asName
});

Expand All @@ -49,7 +49,7 @@ public List<SelectModel> JsonToSelectModels(string json)
}
conditionalModels.Add(new SelectModel()
{
FiledName = fileName,
FieldName = fileName,
AsName = asName
});

Expand All @@ -58,7 +58,7 @@ public List<SelectModel> JsonToSelectModels(string json)
{
conditionalModels.Add(new SelectModel()
{
FiledName = item.ObjToString().Trim(),
FieldName = item.ObjToString().Trim(),
AsName = item.ObjToString().Trim()
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract partial class SqlBuilderProvider : SqlBuilderAccessory, ISqlBuil
{
var orderByModel = item as SelectModel;
orderByModel.AsName=GetAsName(orderByModel);
orderByModel.FiledName = GetSqlPart(orderByModel.FiledName, pars).ObjToString();
orderByModel.FieldName = GetSqlPart(orderByModel.FieldName, pars).ObjToString();
AppendFiledName(sql, orderByModel);
}
else
Expand All @@ -32,7 +32,7 @@ private string GetAsName(SelectModel orderByModel)
{
if (orderByModel.AsName.IsNullOrEmpty())
{
orderByModel.AsName = orderByModel.FiledName.ObjToString();
orderByModel.AsName = orderByModel.FieldName.ObjToString();
}
if (orderByModel.AsName.StartsWith(UtilConstants.ReplaceKey))
{
Expand All @@ -48,7 +48,7 @@ private string GetAsName(SelectModel orderByModel)

private void AppendFiledName(StringBuilder sql, SelectModel orderByModel)
{
sql.Append($" {orderByModel.FiledName} AS {orderByModel.AsName} ,");
sql.Append($" {orderByModel.FieldName} AS {orderByModel.AsName} ,");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ private List<SelectModel> FilterSelect(List<SelectModel> obj)
List<SelectModel> result = new List<SelectModel>();
foreach (var item in obj)
{
if (item.FiledName is string)
if (item.FieldName is string)
{
var tableName = GetTableName(item.FiledName + "");
var columnName = GetColumnName(item.FiledName + "");
var tableName = GetTableName(item.FieldName + "");
var columnName = GetColumnName(item.FieldName + "");
if (IsMyColums(tableName, columnName))
{
result.Add(item);
Expand Down

0 comments on commit d8abcc1

Please sign in to comment.