use of org.nutz.dao.util.cri.SimpleCriteria in project nutz by nutzam.
the class QueryTest method query_by_like_ignorecase.
@Test
public void query_by_like_ignorecase() {
SimpleCriteria cri = Cnd.cri();
cri.where().andLike("name", "PeT6", true);
List<Pet> pets = dao.query(Pet.class, cri, dao.createPager(1, 10));
assertEquals(1, pets.size());
assertEquals("pet6", pets.get(0).getName());
}
use of org.nutz.dao.util.cri.SimpleCriteria in project nutz by nutzam.
the class EachTest method each_by_like_ignorecase.
@Test
public void each_by_like_ignorecase() {
SimpleCriteria cri = Cnd.cri();
cri.where().andLike("name", "PeT6", true);
final List<Pet> pets = new ArrayList<Pet>();
dao.each(Pet.class, cri, dao.createPager(1, 10), new Each<Pet>() {
public void invoke(int i, Pet pet, int length) {
pets.add(pet);
}
});
assertEquals(1, pets.size());
assertEquals("pet6", pets.get(0).getName());
}
use of org.nutz.dao.util.cri.SimpleCriteria in project nutz by nutzam.
the class ManyManyLinkField method createCondition.
public Condition createCondition(Object host) {
SimpleCriteria cri = Cnd.cri();
cri.where().andInBySql(linkedField.getColumnName(), "SELECT %s FROM %s WHERE %s=%s", toColumnName, this.getRelationName(), fromColumnName, Sqls.formatFieldValue(hostField.getValue(host)));
return cri;
}
Aggregations