diff --git a/SQLBuilder/Entry/SqlBuilderCore.cs b/SQLBuilder/Entry/SqlBuilderCore.cs index a36a8c5..3e95acf 100644 --- a/SQLBuilder/Entry/SqlBuilderCore.cs +++ b/SQLBuilder/Entry/SqlBuilderCore.cs @@ -4229,6 +4229,96 @@ public SqlBuilderCore Distinct() } #endregion + #region Append + /// + /// Append + /// + /// 自定义sql语句 + /// SqlBuilderCore + public SqlBuilderCore Append(string sql) + { + this.sqlWrapper += sql; + return this; + } + + /// + /// Append + /// + /// 自定义sql语句 + /// SqlBuilderCore + public SqlBuilderCore Append(StringBuilder sql) + { + this.sqlWrapper.Sql.Append(sql); + return this; + } + #endregion + + #region AppendIf + /// + /// AppendIf + /// + /// 自定义条件 + /// 自定义sql语句 + /// SqlBuilderCore + public SqlBuilderCore AppendIf(bool condition, string sql) + { + if (condition) + this.sqlWrapper += sql; + + return this; + } + + /// + /// AppendIf + /// + /// 自定义条件 + /// 自定义sql语句 + /// 回调委托 + /// SqlBuilderCore + public SqlBuilderCore AppendIf(bool condition, string sql, Action callback) + { + if (condition) + { + this.sqlWrapper += sql; + callback?.Invoke(); + } + + return this; + } + + /// + /// AppendIf + /// + /// 自定义条件 + /// 自定义sql语句 + /// SqlBuilderCore + public SqlBuilderCore AppendIf(bool condition, StringBuilder sql) + { + if (condition) + this.sqlWrapper.Sql.Append(sql); + + return this; + } + + /// + /// AppendIf + /// + /// 自定义条件 + /// 自定义sql语句 + /// 回调委托 + /// SqlBuilderCore + public SqlBuilderCore AppendIf(bool condition, StringBuilder sql, Action callback) + { + if (condition) + { + this.sqlWrapper.Sql.Append(sql); + callback?.Invoke(); + } + + return this; + } + #endregion + #region GetTableName /// /// 获取实体对应的表名