From 78cf945954dfbe1d2919fdfa17f3613784d79169 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 14 Oct 2020 14:26:11 +0800 Subject: [PATCH] Oracle Union all bug --- .../Abstract/SugarProvider/SqlSugarProvider.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs index 0250dd538..bb967c552 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs @@ -467,7 +467,14 @@ namespace SqlSugar var allParameters = allItems.SelectMany(it => it.Value).ToArray(); var resulut = this.Context.Queryable().AS(UtilMethods.GetPackTable(allSql, "unionTable")).With(SqlWith.Null); resulut.AddParameters(allParameters); - return resulut.Select(sqlBuilder.SqlSelectAll); + if (this.Context.CurrentConnectionConfig.DbType == DbType.Oracle && sqlBuilder.SqlSelectAll == "*") + { + return resulut.Select("unionTable.*"); + } + else + { + return resulut.Select(sqlBuilder.SqlSelectAll); + } } public virtual ISugarQueryable UnionAll(List> queryables) where T : class, new() { @@ -495,7 +502,14 @@ namespace SqlSugar var allParameters = allItems.SelectMany(it => it.Value).ToArray(); var resulut = this.Context.Queryable().AS(UtilMethods.GetPackTable(allSql, "unionTable")).With(SqlWith.Null); resulut.AddParameters(allParameters); - return resulut.Select(sqlBuilder.SqlSelectAll); + if (this.Context.CurrentConnectionConfig.DbType == DbType.Oracle && sqlBuilder.SqlSelectAll == "*") + { + return resulut.Select("unionTable.*"); + } + else + { + return resulut.Select(sqlBuilder.SqlSelectAll); + } } public virtual ISugarQueryable Union(List> queryables) where T : class, new() {