diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs index e773e8843..83fc9ab96 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ExpressionContext.cs @@ -246,6 +246,12 @@ namespace SqlSugar return string.Format(" {0} {1} {2} ", GetTranslationColumnName(fieldValue), "AS", GetTranslationColumnName(asName)); } + public virtual string GetAsString2(string asName, string fieldValue) + { + if (fieldValue.Contains(".*") || fieldValue == "*") return fieldValue; + return string.Format(" {0} {1} {2} ",fieldValue, "AS", GetTranslationColumnName(asName)); + } + public virtual string GetEqString(string eqName, string fieldValue) { return string.Format(" {0} {1} {2} ", GetTranslationColumnName(eqName), "=", GetTranslationColumnName(fieldValue)); diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs index ad23892d6..f9f6e6fd6 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve_Item.cs @@ -15,7 +15,14 @@ namespace SqlSugar { this.Expression = item; this.Start(); - parameter.Context.Result.Append(this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString())); + if (ExpressionTool.GetMethodName(item) == "MappingColumn") + { + parameter.Context.Result.Append(this.Context.GetAsString2(asName, parameter.CommonTempData.ObjToString())); + } + else + { + parameter.Context.Result.Append(this.Context.GetAsString(asName, parameter.CommonTempData.ObjToString())); + } } private void ResloveCountAny(ExpressionParameter parameter, Expression item, string asName)