高级查询
//高级查询
/**
* 提交标准SQL到DB查询
*/
public void query1(){
List<Member> list = manager.getDaoSession().queryRaw(Member.class,"where MEM_NAME like ? and _id > ?",new String[]{"%张三%","50"});
Logger.d(list.toString());
}
/**
* 提交QueryBuilder到DB查询
*/
public void query2(){
QueryBuilder<Member> builder = manager.getDaoSession().queryBuilder(Member.class);
List<Member> list = builder.where(MemberDao.Properties.MemSex.ge(99)).list();
Logger.d("QueryBuilder-->"+list.toString());
}
/**
* 提交QueryBuilder到DB查询
*/
public void query3(){
QueryBuilder<Member> builder = manager.getDaoSession().queryBuilder(Member.class);
List<Member> list = builder.whereOr(MemberDao.Properties.MemSex.le(30),MemberDao.Properties.MemName.like("张三1%")).list();
Logger.d("QueryBuilder-->"+list.toString());
}
DEMO入口