mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-31 15:56:25 +08:00
Update union all
This commit is contained in:
parent
1e51138fa0
commit
c28b5287ee
@ -520,9 +520,9 @@ namespace SqlSugar
|
||||
string sql = sqlObj.Key;
|
||||
UtilMethods.RepairReplicationParameters(ref sql, sqlObj.Value.ToArray(), i, "UnionAll");
|
||||
if (sqlObj.Value.HasValue())
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>($" ( {sql} ) ", sqlObj.Value));
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>(GetUnionFomatSql(sql), sqlObj.Value));
|
||||
else
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>($" ( {sql} ) ", new List<SugarParameter>()));
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>(GetUnionFomatSql(sql), new List<SugarParameter>()));
|
||||
i++;
|
||||
}
|
||||
var allSql = sqlBuilder.GetUnionAllSql(allItems.Select(it => it.Key).ToList());
|
||||
@ -557,9 +557,9 @@ namespace SqlSugar
|
||||
string sql = sqlObj.Key;
|
||||
UtilMethods.RepairReplicationParameters(ref sql, sqlObj.Value.ToArray(), i, "Union");
|
||||
if (sqlObj.Value.HasValue())
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>($" ( {sql} ) ", sqlObj.Value));
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>(GetUnionFomatSql(sql), sqlObj.Value));
|
||||
else
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>($" ( {sql} ) ", new List<SugarParameter>()));
|
||||
allItems.Add(new KeyValuePair<string, List<SugarParameter>>(GetUnionFomatSql(sql), new List<SugarParameter>()));
|
||||
i++;
|
||||
}
|
||||
var allSql = sqlBuilder.GetUnionSql(allItems.Select(it => it.Key).ToList());
|
||||
@ -580,6 +580,17 @@ namespace SqlSugar
|
||||
Check.Exception(queryables.IsNullOrEmpty(), "Union.queryables is null ");
|
||||
return Union(queryables.ToArray());
|
||||
}
|
||||
private string GetUnionFomatSql(string sql)
|
||||
{
|
||||
if (this.CurrentConnectionConfig.DbType == DbType.Access)
|
||||
{
|
||||
return sql;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $" ( {sql} ) ";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SqlQueryable
|
||||
|
Loading…
Reference in New Issue
Block a user