zoukankan      html  css  js  c++  java
  • xpo 条件查询

    一般条件:Name为A

    XPCollection xp = SpecialPlayNu.GetByCompany(DataBase.XpoSession,int.Parse(Session["CompanyId"].ToString()));
    GroupOperator gxp = new GroupOperator();
    gxp.Operands.Add(new BinaryOperator("Name", "A"));
    xp.Filter = gxp;

    或条件:Name为A或B

    XPCollection xpClasses2 = PlayeType.GetAll(DataBase.XpoSession);//得到记录集
    xpClasses2.Sorting.Add(new SortProperty("Name", SortingDirection.Ascending));//设定排序规则
    GroupOperator gxp = new GroupOperator();
    gxp.Operands.Add(new GroupOperator(GroupOperatorType.Or, new BinaryOperator("Name", "A"), new BinaryOperator("Name", "B")));
    xpClasses2.Filter = gxp;

    大小条件:
    GroupOperator gxp = new GroupOperator();

    Money大于或等于1
    gxp.Operands.Add(new BinaryOperator("Money", 1, BinaryOperatorType.GreaterOrEqual));

    Money等于1
    gxp.Operands.Add(new BinaryOperator("Money", 1, BinaryOperatorType.Equal));

    Money大于1
    gxp.Operands.Add(new BinaryOperator("Money", 1, BinaryOperatorType.Greater));

    Money小于或等于1
    gxp.Operands.Add(new BinaryOperator("Money", 1, BinaryOperatorType.LessOrEqual));

    Money小于1
    gxp.Operands.Add(new BinaryOperator("Money", 1, BinaryOperatorType.Less));


    模湖条件:

    Name值包含ABC的数据

    gxp.Operands.Add(new BinaryOperator("Name","%ABC%",BinaryOperatorType.Like));


    时间条件:

    CreatTime时间在starttime到endtime
    string format = "yyyy-MM-dd 0:0:0";
    DateTime dt1 = DateTime.Now;
    dt1 = dt1.AddDays(-1);
    starttime = dt1.Date.ToString(format);
    format = "yyyy-MM-dd 23:59:59";
    dt1 = dt1.AddDays(+1);
    endtime = dt1.Date.ToString(format);

    group.Operands.Add(new BinaryOperator("CreatTime", starttime, BinaryOperatorType.GreaterOrEqual));
    group.Operands.Add(new BinaryOperator("CreatTime", endtime, BinaryOperatorType.LessOrEqual));

    //设定排序条件
    private void SetSorts(XPCollection aXp)
    {
    SortingCollection sorts = new SortingCollection();
    sorts.Add(new SortProperty("Id", SortingDirection.Descending));
    aXp.Sorting.Add(sorts);
    }
    aXp.Sorting.Add(new SortProperty("Name",SortingDirection.Ascending));//设定排序规则

  • 相关阅读:
    相对路径和绝对路径的问题"/"带不带斜杠
    El表达式获取项目名称
    struts 中的创建Action的三种方法
    maven中的profile文件的解析
    Maven中模块的聚合以及对jar包的继承
    Maven中解决依赖冲突的问题
    maven中的传递依赖和传递依赖的解除
    String类为什么是final的
    jdbc 报错解决办法
    org.hibernate.PropertyValueException: not-null property references a null or transient value:
  • 原文地址:https://www.cnblogs.com/li-lun/p/4698679.html
Copyright © 2011-2022 走看看