Search in sources :

Example 16 with Criteria

use of org.nutz.dao.sql.Criteria in project nutz by nutzam.

the class CndTest method test_in_by_criteria_string_list.

/**
 *  Criteria 接口测试List<String>
 */
@Test
public void test_in_by_criteria_string_list() {
    List<String> ids = new ArrayList<String>();
    ids.add("bj");
    ids.add("sh");
    ids.add("gz");
    ids.add("sz");
    Criteria cri = Cnd.cri();
    cri.where().andInStrList("nm", ids);
    assertEquals(" WHERE nm IN ('bj','sh','gz','sz')", cri.toString());
}
Also used : ArrayList(java.util.ArrayList) Criteria(org.nutz.dao.sql.Criteria) Test(org.junit.Test)

Example 17 with Criteria

use of org.nutz.dao.sql.Criteria in project nutz by nutzam.

the class CndTest method test_not_in_by_criteria_int_list.

/**
 *  Criteria 接口测试List&lt;Integer&gt;
 */
@Test
public void test_not_in_by_criteria_int_list() {
    List<Integer> ids = new ArrayList<Integer>();
    ids.add(1);
    ids.add(2);
    ids.add(3);
    Criteria cri = Cnd.cri();
    cri.where().andNotInIntList("nm", ids);
    assertEquals(" WHERE nm NOT IN (1,2,3)", cri.toString());
}
Also used : ArrayList(java.util.ArrayList) Criteria(org.nutz.dao.sql.Criteria) Test(org.junit.Test)

Example 18 with Criteria

use of org.nutz.dao.sql.Criteria in project nutz by nutzam.

the class CndTest method test_not_in_by_criteria_int_array.

/**
 *  Criteria 接口测试int[]数组
 */
@Test
public void test_not_in_by_criteria_int_array() {
    int[] ids = { 1, 2, 3 };
    Criteria cri = Cnd.cri();
    cri.where().andNotInArray("nm", ids);
    assertEquals(" WHERE nm NOT IN (1,2,3)", cri.toString());
}
Also used : Criteria(org.nutz.dao.sql.Criteria) Test(org.junit.Test)

Example 19 with Criteria

use of org.nutz.dao.sql.Criteria in project nutz by nutzam.

the class CndTest method test_in_by_criteria_int_list.

/**
 *  Criteria 接口测试List&lt;Integer&gt;
 */
@Test
public void test_in_by_criteria_int_list() {
    List<Integer> ids = new ArrayList<Integer>();
    ids.add(1);
    ids.add(2);
    ids.add(3);
    Criteria cri = Cnd.cri();
    cri.where().andInIntList("nm", ids);
    assertEquals(" WHERE nm IN (1,2,3)", cri.toString());
}
Also used : ArrayList(java.util.ArrayList) Criteria(org.nutz.dao.sql.Criteria) Test(org.junit.Test)

Aggregations

Criteria (org.nutz.dao.sql.Criteria)19 Test (org.junit.Test)15 ArrayList (java.util.ArrayList)7 Pojo (org.nutz.dao.sql.Pojo)4 SimpleCriteria (org.nutz.dao.util.cri.SimpleCriteria)4 ConditionPItem (org.nutz.dao.impl.sql.pojo.ConditionPItem)3 LinkField (org.nutz.dao.entity.LinkField)2 LinkVisitor (org.nutz.dao.entity.LinkVisitor)2 DoClearLinkVisitor (org.nutz.dao.impl.link.DoClearLinkVisitor)2 DoClearRelationByHostFieldLinkVisitor (org.nutz.dao.impl.link.DoClearRelationByHostFieldLinkVisitor)2 DoClearRelationByLinkedFieldLinkVisitor (org.nutz.dao.impl.link.DoClearRelationByLinkedFieldLinkVisitor)2 DoDeleteLinkVisitor (org.nutz.dao.impl.link.DoDeleteLinkVisitor)2 DoInsertLinkVisitor (org.nutz.dao.impl.link.DoInsertLinkVisitor)2 DoInsertRelationLinkVisitor (org.nutz.dao.impl.link.DoInsertRelationLinkVisitor)2 DoUpdateLinkVisitor (org.nutz.dao.impl.link.DoUpdateLinkVisitor)2 DoUpdateRelationLinkVisitor (org.nutz.dao.impl.link.DoUpdateRelationLinkVisitor)2 PItem (org.nutz.dao.sql.PItem)2 Pet (org.nutz.dao.test.meta.Pet)2 SqlExpressionGroup (org.nutz.dao.util.cri.SqlExpressionGroup)2 Condition (org.nutz.dao.Condition)1