public List findProListByKeyWords(String keyWords,int limit) {
String sqls="SELECT * FROM r_products where productName like @keyWords"
+" GROUP BY categoryId ORDER BY COUNT(id) DESC limit "+limit;
Sql sql = Sqls.queryEntity(sqls);//参数化
sql.setEntity(getDao().getEntity(Product.class));
sql.params().set("keyWords", "%"+keyWords+"%");
getDao().execute(sql);
List list=sql.getList(Product.class);
if(list==null||list.size()==0){
return null;
}
return list;
}
7 回复
添加回复
请先登陆