mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-05 03:17:41 +08:00
Update subquery
This commit is contained in:
@@ -186,9 +186,9 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
var asName = this.context.GetTranslationTableName(asItems.First().Replace(subKey, ""), false);
|
var asName = this.context.GetTranslationTableName(asItems.First().Replace(subKey, ""), false);
|
||||||
var repKey = $"\\{this.context.SqlTranslationLeft}.+\\{this.context.SqlTranslationRight}";
|
var repKey = $"\\{this.context.SqlTranslationLeft}.+\\{this.context.SqlTranslationRight}";
|
||||||
if (this.context.CurrentShortName.HasValue())
|
if (this.context.IsSingle&&this.context.JoinIndex==0&&this.context.CurrentShortName.HasValue()&& isAsAttr&& !asName.Contains(this.context.CurrentShortName))
|
||||||
{
|
{
|
||||||
asName = asName + " " + this.context.CurrentShortName;
|
asName = asName + " " + this.context.CurrentShortName+" ";
|
||||||
}
|
}
|
||||||
sqlItems[i] = Regex.Replace(sqlItems[i], repKey, asName);
|
sqlItems[i] = Regex.Replace(sqlItems[i], repKey, asName);
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,13 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
if (sqlItems[i].StartsWith("FROM " + this.context.SqlTranslationLeft))
|
if (sqlItems[i].StartsWith("FROM " + this.context.SqlTranslationLeft))
|
||||||
{
|
{
|
||||||
sqlItems[i] = sqlItems[i]+" "+this.context.CurrentShortName +" ";
|
if (isAsAttr&&sqlItems[i].EndsWith(this.context.CurrentShortName + " "))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sqlItems[i] = sqlItems[i] + " " + this.context.CurrentShortName + " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user