Xutils 按條件查詢

2021-06-28 15:18:37 字數 1485 閱讀 5376

//

查parententity = db.findbyid(parent.class, parent.getid());

parententity = db.findfirst(entity);//通過entity的屬性查詢

listlist = db.findall(entity);//通過entity的屬性查詢

listlist = db.findall(parent.class);//通過型別查詢

parentparent =db.findfirst(selector.from(parent.class).where("name","=","test"));

//is null

parentparent = db.findfirst(selector.from(parent.class).where("name","=",null));

//is not null

parentparent = db.findfirst(selector.from(parent.class).where("name","!=",null));

//where id<54 and (age>20 or age<30) order by id limitpagesize offset pageoffset

listlist = db.findall(selector.from(parent.class)

.where("id","<", 54)

.and(wherebuilder.b("age",">", 20).or("age", " < ", 30))

.orderby("id")

.limit(pagesize)

.offset(pagesize* pageindex));

//op為"in"時,最後乙個引數必須是陣列或iterable的實現類(例如list等)

parenttest = db.findfirst(selector.from(parent.class).where("id","in", new int));

//op為"between"時,最後乙個引數必須是陣列或iterable的實現類(例如list等)

parenttest = db.findfirst(selector.from(parent.class).where("id","between", new string));

dbmodeldbmodel =db.finddbmodelall(selector.from(parent.class).select("name"));//select("name")只取出name列

listdbmodels =db.finddbmodelall(selector.from(parent.class).groupby("name").select("name","count(name)"));

...listdbmodels = db.finddbmodelall(sql); // 自定義sql查詢

db.execnonquery(sql)// 執行自定義sql

HBase按條件查詢程式設計

1 行過濾,列印顯示行號小於等於row010的所有行資料 public void scandata1 throws exception 關閉資源 table.close conn.close 2 獲得行id中含有9的所有行,子串比較 public void scandata2 throws exce...

使用Sql按日期條件查詢

查詢當天 1 select from shoporder where datediff day,ordtime,getdate 1 0 查詢當天 2 select from info where datediff dd,datetime,getdate 0 前30天 select from a wh...

SQL語句(八)按條件查詢

select from student select sclass,snumb,sname from student 物理班有哪些同學 年齡小於20歲的有哪些同學?定價在30元以下的計算機書有哪些?sname 張三 sname 張三 snumb 10001 sbirthday 1996 01 01 ...