DataGrid dg = new DataGrid();
List<OrderTiming> l = new ArrayList<OrderTiming>();
List<TorderTiming> list = new ArrayList<TorderTiming>();
String hql = "from TorderTiming t where 1=1";
String totalHql = "select count(*) from TorderTiming t where 1=1";
Map<String, Object> params = new HashMap<String, Object>();
if(startdate != null && !startdate.equals("")){
hql += " and t.orderTime >=:startdate";
totalHql += " and t.orderTime >=:startdate";
params.put("startdate", startdate);
}
if(enddate != null && !enddate.equals("")){
hql += " and t.orderTime <=:enddate";
totalHql += " and t.orderTime <=:enddate";
params.put("enddate", enddate);
}
if(importStart != null && !importStart.equals("")){
hql += " and t.importTime >=:importStart";
totalHql += " and t.importTime >=:importStart";
params.put("importStart", importStart);
}
if(importEnds != null && !importEnds.equals("")){
hql += " and t.importTime <=:importEnds";
totalHql += " and t.importTime <=:importEnds";
params.put("importEnds", importEnds);
}
//手机号
if(msisdn != null && !msisdn.equals("")){
hql += " and t.msisdn like:msisdn";
totalHql += " and t.msisdn like:msisdn";
params.put("msisdn", "%"+msisdn+"%");
}
list = orderTimingDao.find(hql, params, orderTiming.getPage(), orderTiming.getRows());
if(list != null && list.size()>0){
for(TorderTiming t: list){
OrderTiming orderTime = new OrderTiming();
orderTime.setOrderId(t.getOrderId());
orderTime.setProductId(t.getProductId());
orderTime.setMsisdn(t.getMsisdn());
orderTime.setOrderStatus(t.getOrderStatus());
orderTime.setOrderTime(t.getOrderTime());
orderTime.setUpdateTime(t.getUpdateTime());
orderTime.setImportTime(t.getImportTime());
l.add(orderTime);
i++;
}
}
}
}
dg.setTotal(i);
dg.setRows(l);
return dg;
hql语句中用:号的时候怎么用like进行条件查询
最新推荐文章于 2024-12-12 22:12:57 发布