diff --git a/Src/Asp.NetCore2/SqlSugar.OceanBaseForOracle/OceanBase/SqlBuilder/OceanBaseForOracleExpressionContext.cs b/Src/Asp.NetCore2/SqlSugar.OceanBaseForOracle/OceanBase/SqlBuilder/OceanBaseForOracleExpressionContext.cs index 31c8bc592..5fc03c9aa 100644 --- a/Src/Asp.NetCore2/SqlSugar.OceanBaseForOracle/OceanBase/SqlBuilder/OceanBaseForOracleExpressionContext.cs +++ b/Src/Asp.NetCore2/SqlSugar.OceanBaseForOracle/OceanBase/SqlBuilder/OceanBaseForOracleExpressionContext.cs @@ -16,6 +16,7 @@ namespace SqlSugar.OceanBaseForOracle public OceanBaseForOracleExpressionContext() { base.DbMehtods = new OceanBaseForOracleMethod(); + base.Case = new ExpressionContextCase(); } public override string SqlParameterKeyWord { @@ -76,7 +77,7 @@ namespace SqlSugar.OceanBaseForOracle public override string GetLimit() { int num = 1; - if (this.Case?.Num != 1) + if (this.Case?.Num > 1) { num = this.Case.Num; } diff --git a/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs b/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs index 05cb81a82..c8b713ef9 100644 --- a/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs +++ b/Src/Asp.NetCore2/SqlSugar.TDSQLForPGODBC/TDSQLForPG/SqlBuilder/TDSQLForPGODBCExpressionContext.cs @@ -8,6 +8,7 @@ namespace SqlSugar.TDSQLForPGODBC public TDSQLForPGODBCExpressionContext() { base.DbMehtods = new TDSQLForPGODBCMethod(); + base.Case = new ExpressionContextCase(); } public override string SqlTranslationLeft { @@ -134,7 +135,7 @@ namespace SqlSugar.TDSQLForPGODBC public override string GetLimit() { int num = 1; - if (this.Case.Num != 1) + if (this.Case.Num > 1) { num = this.Case.Num; } diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs index 534fa0a5d..3270810e6 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTake.cs @@ -82,12 +82,9 @@ namespace SqlSugar } else if (this.Context.GetLimit() != null) { - if (this?.Context?.Case?.HasWhere == true) + if (this?.Context?.Case != null) { this.Context.Case.HasWhere = this.HasWhere; - } - if (this?.Context?.Case?.Num != 1) - { this.Context.Case.Num = num; } return this.Context.GetLimit(); diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs index 312ed677b..a9396d65a 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs @@ -67,7 +67,7 @@ namespace SqlSugar } else if (this.Context.GetLimit()!=null) { - if (this?.Context?.Case?.HasWhere == true) + if (this?.Context?.Case != null) { this.Context.Case.HasWhere = this.HasWhere; }