Update Core

This commit is contained in:
sunkaixuan 2022-05-21 18:50:06 +08:00
parent 60dacbbccf
commit a933c2f4ee

View File

@ -123,13 +123,20 @@ namespace SqlSugar
mappingA = queryable.QueryBuilder.Builder.GetTranslationColumnName(mappingA);
mappingB = queryable.QueryBuilder.Builder.GetTranslationColumnName(mappingB);
var bTableName = queryable.QueryBuilder.Builder.GetTranslationTableName(this.ProPertyEntity.DbTableName);
mapper.Sql = $" (select count(1) from {bTableName} {this.ProPertyEntity.DbTableName}_1 where {this.ProPertyEntity.DbTableName}_1.{bPk} in (select {mappingB} from {mappingTableName} where {mappingA} = {ShorName}.{aPk} ) )";
mapper.Sql = $" (select {(MethodName == "Any" ? "1":" COUNT(1) ")} from {bTableName} {this.ProPertyEntity.DbTableName}_1 where {this.ProPertyEntity.DbTableName}_1.{bPk} in (select {mappingB} from {mappingTableName} where {mappingA} = {ShorName}.{aPk} ) )";
if (this.whereSql.HasValue())
{
mapper.Sql = mapper.Sql.TrimEnd(')');
mapper.Sql = mapper.Sql + " AND " + this.whereSql+")";
}
mapper.Sql = $" ({mapper.Sql}) ";
if (MethodName == "Any")
{
mapper.Sql = $" {mapper.Sql} ";
}
else
{
mapper.Sql = $" ({mapper.Sql}) ";
}
mapper.Sql = GetMethodSql(mapper.Sql);
return mapper;
}