public BaseConditionParameter(string type, IColumnObject first, IConditionRightSideObject second)
        {
            var item = typeMapping.First(t => t.Item2 == type);

            if (item == null)
            {
                throw new ParameterParseException(string.Format("Unknown condition type [{0}].", type));
            }

            ConditionType = item.Item1;
            stringFormat  = item.Item3;
            First         = first;
            Second        = second;
        }
        public static BaseConditionParameter TranslateByDictionary(string type, object dicObj, bool canUseAggregation)
        {
            var dic = dicObj as IDictionary <string, JToken>;

            if (dic == null)
            {
                throw new Exception("条件指令内容错误!");
            }
            IColumnObject             firstCO    = null;
            IConditionRightSideObject secondCRSO = null;
            object value = null;

            if (dic.ContainsKey("$key"))
            {
                //复杂形式
                if (!dic.ContainsKey("$value"))
                {
                    throw new Exception("条件指令复杂形式必须同时设置$key与$value值");
                }
                if (!(dic["$key"] is IDictionary <string, object>))
                {
                    throw new Exception("条件指令复杂形式$key必须为字段对象!");
                }
                var firstDic = dic["$key"] as IDictionary <string, object>;
                if (!firstDic.ContainsKey("$name"))
                {
                    throw new Exception("条件指令复杂形式$key对应的字段对象必须包含$name!");
                }

                if (canUseAggregation)
                {
                    var cco = new ComplexColumnObject()
                    {
                        Name = firstDic["$name"].ToString()
                    };
                    if (firstDic.ContainsKey("$aggregation") && firstDic["$aggregation"] != null)
                    {
                        cco.Aggregation = firstDic["$aggregation"].ToString().ToAggregationType();
                        if (cco.Aggregation == null)
                        {
                            throw new Exception("聚合指令无法识别!");
                        }
                    }
                    if (firstDic.ContainsKey("$distinct") && firstDic["$distinct"] != null)
                    {
                        cco.IsDistinct = firstDic["$distinct"].ToString().ToLower().Equals("false");
                    }
                    firstCO = cco;
                }
                else
                {
                    firstCO = new SimpleColumnObject()
                    {
                        Name = firstDic["$name"].ToString()
                    };
                }

                value = dic["$value"];
            }
            else
            {
                //简单形式
                if (dic.Keys.Count != 1)
                {
                    throw new Exception("条件指令简单形式对应的对象中不支持多字段的判断!");
                }
                firstCO = new SimpleColumnObject()
                {
                    Name = dic.Keys.First()
                };
                value = dic.First().Value;
            }

            if (value is IDictionary <string, object> )
            {
                var secondDic = value as IDictionary <string, object>;
                if (canUseAggregation)
                {
                    var cco = new ComplexColumnObject()
                    {
                        Name = secondDic["$name"].ToString()
                    };
                    if (secondDic.ContainsKey("$aggregation") && secondDic["$aggregation"] != null)
                    {
                        cco.Aggregation = secondDic["$aggregation"].ToString().ToAggregationType();
                        if (cco.Aggregation == null)
                        {
                            throw new Exception("聚合指令无法识别!");
                        }
                    }
                    if (secondDic.ContainsKey("$distinct") && secondDic["$distinct"] != null)
                    {
                        cco.IsDistinct = secondDic["$distinct"].ToString().ToLower().Equals("false");
                    }
                    secondCRSO = cco;
                }
                else
                {
                    secondCRSO = new SimpleColumnObject()
                    {
                        Name = secondDic["$name"].ToString()
                    };
                }
            }
            else
            {
                secondCRSO = new ValueObject()
                {
                    Value = value
                };
            }

            return(new BaseConditionParameter(type, firstCO, secondCRSO));
        }