//拼接查询条件
public Query getQuery(String hql,Map, ?> map)
{
String orderCode=(String) map.get("orderCode");
String productName=(String) map.get("productName");
Date stringTodate=stringToDate((String) map.get("orderDueTimeString"));
StringBuffer sb = new StringBuffer(hql);
if(orderCode!=null && !"".equals(orderCode))
{
sb.append(" and mpo.productOrderCode like :orderCode");
}
if(productName!=null && !"".equals(productName))
{
sb.append(" and mec.productName like :productName");
}
if(stringTodate!=null && !"".equals(stringTodate))
{
sb.append(" and mpo.productOrderDueTime >= :dueTime and mpo.productOrderDueTime < :dueTime+1");
}
Query query = (Query) super.getSession().createQuery(sb.toString());
if(orderCode!=null && !"".equals(orderCode))
{
query.setString("orderCode", "%"+orderCode.toString()+"%");
}
if(productName!=null && !"".equals(productName))
{
query.setString("productName", "%"+productName.toString()+"%");
}
if(stringTodate!=null && !"".equals(stringTodate))
{
query.setDate("dueTime", stringTodate);
}
return query;
}