模糊查询like中value前后需要根据需要拼接%
like("%" + value
+ "%")
QueryBuilder
<People> queryBuilder
= PeopleSession
.queryBuilder();
if (!TextUtils
.isEmpty(cardId
)) {
queryBuilder
.where(PeopleDao
.Properties
.CardId
.like("%" + cardId
+ "%"));
}
if (!TextUtils
.isEmpty(nameStr
)) {
queryBuilder
.where(PeopleDao
.Properties
.Name
.like("%" + nameStr
+ "%"));
}
if (!TextUtils
.isEmpty(phoneStr
)) {
queryBuilder
.where(PeopleDao
.Properties
.Phone
.like("%" + phoneStr
+ "%"));
}
queryBuilder
.orderAsc(PeopleDao
.Properties
.CardId
, PeopleDao
.Properties
.Name
).build();
return queryBuilder
.offset(pageNum
* Constants
.PAGE_SIZE
).limit(Constants
.PAGE_SIZE
).list();
转载请注明原文地址: https://mac.8miu.com/read-494438.html