﻿using System.Collections.Generic;
using System.Linq;
using Naxis.Dapper.Wrap.Expressions;

namespace Naxis.Dapper.Wrap.Statements
{
    /// <summary>
    /// 排序部分
    /// </summary>
    public class StatementOrder
    {
        private Dictionary<ColumnExpression, OrderOptions> _columns = new Dictionary<ColumnExpression, OrderOptions>();

        /// <summary>
        /// 列表达式列表
        /// </summary>
        public Dictionary<ColumnExpression, OrderOptions> Columns
        {
            get { return _columns; }
            set { _columns = value; }
        }

        public override string ToString()
        {
            return string.Format("{0}", string.Join(", ", _columns.Select(x => string.Format("{0} {1}", x.Key, x.Value.ToString().ToUpper()))));
        }
    }
}
