Package org.fto.jthink.jdbc

Examples of org.fto.jthink.jdbc.ConditionItem


    condn = new Condition();
    System.out.println("getConditionString=("+condn.getConditionString()+")");
    assertTrue(condn.getConditionString().length()==0);
    printObjects(condn.getValues());

    condn.add(" anD ", new ConditionItem("DeptId", "=", "1"));
    condn.add(Condition.AND, new ConditionItem("DeptId", "=", "2857"));
    condn.add(Condition.AND, new ConditionItem("DeptName", "Like", "%部%"));
    condn.add(new ConditionItem("DeptId", "Between", new Object[]{"1","3"}));
    condn.add(new ConditionItem("DeptId", "IN", new Object[]{"1","2", "3", "4"}));
    System.out.println("getConditionString=("+condn.getConditionString()+")");
    printObjects(condn.getValues());

    Condition condn1 = new Condition();
    condn1.add(new ConditionItem("DeptId", "!=", "3"));

   
    Condition condn2 = new Condition();
    condn2.add(Condition.OR, new ConditionItem("DeptId", "=", "1"));
//    condn2.add(Condition.OR, "DeptId", "=", "2");
//    condn2.add(Condition.OR, "DeptId", "IN", new Object[]{"3", "4", "5"});
    condn2.add(Condition.OR, new ConditionItem("DeptId", "Between", new Object[]{"6", "9"}));
    System.out.println("getConditionString=("+condn2.getConditionString()+")");
    printObjects(condn2.getValues());
   
    condn1.add("OR", condn2);
   
    condn = new Condition();
    condn.add(Condition.AND_NOT, new ConditionItem("DeptName", "like", "%部%"));
    condn.add(Condition.AND, condn1);
    condn.add(Condition.AND_NOT, new ConditionItem("DeptDesc", "like", "%技术%"));
    System.out.println("getConditionString=("+condn.getConditionString()+")");
    assertEquals(condn.getConditionString().trim(), "NOT DeptName like ? AND ( DeptId != ? OR ( DeptId = ? OR DeptId Between ? AND ? ) ) AND NOT DeptDesc like ?");
    printObjects(condn.getValues());
   
    Condition deptCondn = new Condition();
    deptCondn.add(new ConditionItem("Depts.DeptId", "=", "Users.DeptId", true));
    SQL sql = sqlBuilder.constructSQLForSelect("Depts", new Column[]{new Column("DeptName")},deptCondn);
   
    condn = new Condition();
    condn.add(new ConditionItem("DeptName", "like", "%部%", true));
    condn.add(new ConditionItem("Depts.DeptId", "=", "Users.DeptId", true));
    condn.add(new ConditionItem("DeptName", "=", sql));
//    System.out.println("getConditionString=("+condn.getConditionStatement()+")");
    printObjects(condn.getValues());
   
   
    /* Condition测试开始 */
    {
      double totalUseTime = 0;
      int count = 0;
      for(int i=0;i<2000;i++){//在此设置测试次数
          long stime = System.nanoTime();       
          /* 测试代码 开始 */
         
          condn = new Condition();
          condn.add(new ConditionItem("DeptName", "like", "%部%", true));
          condn.add(new ConditionItem("Depts.DeptId", "=", "Users.DeptId", true));
          condn.add(new ConditionItem("DeptName", "=", sql));
         
          condn2 = new Condition();
          condn2.add(Condition.OR, new ConditionItem("DeptId", "=", "1"));
          condn2.add(new ConditionItem("DeptId", "=", "2"));
          condn2.add(new ConditionItem("DeptId", "IN", new Object[]{"3", "4", "5"}));
          condn2.add(Condition.OR, new ConditionItem("DeptId", "Between", new Object[]{"6", "9"}));
         
          condn1 = new Condition();
          condn1.add(new ConditionItem("DeptId", "!=", "3"));
          condn1.add("OR", condn2);
         
          condn.add(Condition.AND, condn1);
         
          //condn.getValueList();
View Full Code Here


        new Column("Reverter"),
      };
     
      /* 条件 */
      Condition condition = new Condition();
      condition.add(new ConditionItem("ID","=", request.getParameter("ID")));
     
      /* 构建SQL语句 */
      SQL sql = sqlBuilder.constructSQLForSelect("Messages", column, condition);
      /* 执行SQL语句,并返回结果 */
      Iterator it = ((List)sqlExecutor.execute(sql, Message.class)).iterator();
View Full Code Here

        new Column("Reverter"),
      };
     
      /* 条件 */
      Condition condition = new Condition();
      condition.add(new ConditionItem("ID","=", request.getParameter("ID")));
     
      /* 构建SQL语句 */
      SQL sql = sqlBuilder.constructSQLForSelect("Messages", column, condition);
      /* 执行SQL语句,并返回结果 */
      Iterator it = ((List)sqlExecutor.execute(sql, Message.class)).iterator();
View Full Code Here

        new Column("Reverter"),
      };
     
      /* 条件 */
      Condition condition = new Condition();
      condition.add(new ConditionItem("ID","=", request.getParameter("ID")));
     
      /* 构建SQL语句 */
      SQL sql = sqlBuilder.constructSQLForSelect("Messages", column, condition);
      /* 执行SQL语句,并返回结果 */
      Iterator it = ((List)sqlExecutor.execute(sql)).iterator();
View Full Code Here

      }
     
      msgsHM.put("RevertTime", DateTimeHelper.formatDateTimetoString(DateTimeHelper.getSystemDate()));

      Condition condition = new Condition();
      condition.add(new ConditionItem("ID","=", request.getParameter("ID")));


      SQL sql = sqlBuilder.constructSQLForUpdate("Messages", msgsHM, condition);
     
      /* 执行SQL语句 */
 
View Full Code Here

    try{
      /* 开始事务 */
      transactionManager.begin();
     
      Condition condition = new Condition();
      condition.add(new ConditionItem("ID","=", request.getParameter("ID")));
     
      SQL sql = sqlBuilder.constructSQLForDelete("Messages", condition);
     
      /* 执行SQL语句 */
      sqlExecutor.execute(sql);
 
View Full Code Here

TOP

Related Classes of org.fto.jthink.jdbc.ConditionItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.