/// <summary>
 /// 创建Sql语句
 /// </summary>
 protected void CreateSqlByNoUnion(StringBuilder result)
 {
     AppendSelect(result);
     AppendFrom(result);
     AppendSql(result, JoinClause.ToSql());
     AppendSql(result, WhereClause.ToSql());
     AppendSql(result, GroupByClause.ToSql());
     AppendSql(result, OrderByClause.ToSql());
     AppendLimit(result);
 }
Exemple #2
0
 /// <summary>
 /// 创建Sql语句
 /// </summary>
 protected virtual void CreateSql(StringBuilder result)
 {
     AppendSelect(result);
     AppendFrom(result);
     AppendSql(result, JoinClause.ToSql());
     AppendSql(result, GetWhere());
     AppendSql(result, GroupByClause.ToSql());
     AppendSql(result, OrderByClause.ToSql());
     AppendLimit(result);
 }
 /// <summary>
 /// 创建Sql语句 - 联合
 /// </summary>
 protected void CreateSqlByUnion(StringBuilder result)
 {
     result.Append("(");
     AppendSelect(result);
     AppendFrom(result);
     AppendSql(result, JoinClause.ToSql());
     AppendSql(result, WhereClause.ToSql());
     AppendSql(result, GroupByClause.ToSql());
     AppendSql(result, ")");
     foreach (var operation in UnionItems)
     {
         AppendSql(result, operation.Name);
         AppendSql(result, $"({operation.Builder.ToSql()}");
         AppendSql(result, ")");
     }
     AppendSql(result, OrderByClause.ToSql());
     AppendLimit(result);
 }
 /// <summary>
 /// 获取Sql语句
 /// </summary>
 private string GetSql()
 {
     return(_clause.ToSql());
 }
 /// <summary>
 /// 获取分组语句
 /// </summary>
 /// <returns></returns>
 public virtual string GetGroupBy()
 {
     return(GroupByClause.ToSql());
 }