Example #1
0
        public Soway.Query.BoolExp.BoolExpression GetQueryExp(Soway.Service.Report.BoolExp exp, QueryModel model, Model.SqlCon con, Soway.Query.QueryInstance ins)
        {
            Soway.Query.BoolExp.BoolExpresstionFacotry fac = new Query.BoolExp.BoolExpresstionFacotry(ins);
            var result = new BoolExpression();

            if (exp.Col != null)
            {
                //简单类型
                var col = model.Columns.First(p => p.ID == exp.Col.ID);

                result.Exp = fac.CreateBoolExpression(new Query.CompareCol()
                {
                    Col = col,
                    SelectedTableName = model.Table.ShowName
                }, QueryCache.GetCompareType(con, col.DataType).First(p => p.ID.ToString() == exp.CompareOp.ID), exp.ValueExp,
                                                      exp.ValueFmt, exp.ParamName);
            }
            else if (exp.FirstExp != null)
            {
                //复杂类型

                result =
                    GetQueryExp(exp.FirstExp, model, con, ins);
                foreach (var sequence in exp.Sequences)
                {
                    fac.AddBoolExpression(
                        result,
                        sequence.BoolOp,
                        GetQueryExp(sequence.AddedExp, model, con, ins));
                }
            }


            return(result);
        }
Example #2
0
        protected override void ImplementBusinessLogic()
        {
            var view       = new Soway.Model.View.AutoViewFactory(this.Info.AppSqlCon, this).GetView(this.Opt.ViewId);
            var queryModel = new Soway.Model.Query.QueryFactory(this.Info.AppSqlCon, this).GetQueryModel(view);

            this.ReturnData.Cols = new List <QueryCol>();
            foreach (var col in queryModel.Columns)
            {
                var item = new QueryCol()
                {
                    Name    = col.ShowName,
                    ID      = col.ID,
                    PrpType = col.DataType,
                    ModelId = col.ModelId,
                    States  = col.States
                };
                item.CompareTypes = new List <CompareOpItem>();
                foreach (var compare in QueryCache.GetCompareType(this.Info.AppSqlCon, col.DataType))
                {
                    item.CompareTypes.Add(new CompareOpItem()
                    {
                        ID   = compare.ID.ToString(),
                        Name = compare.ShowName
                    });
                }

                item.QueryTypes = new List <QueryType>();

                foreach (var select in QueryCache.GetSelectedType(this.Info.AppSqlCon, col.DataType))
                {
                    item.QueryTypes.Add(new QueryType()
                    {
                        ID   = select.ID.ToString(),
                        Name = select.Show,
                    });
                }
                this.ReturnData.Cols.Add(item);
            }
        }