日期:2014-05-19 浏览次数:20747 次
//如果关键字KEYWORD不为空
if(typeId != null && !StringUtils.isEmpty(keyword)){
String tmp = "";
if (typeId<2) {
switch (typeId){
case 0:
tmp = "id";
break;
case 1:
tmp = "userId";
break;
}
whereSql = "from Order a where a. "+tmp+" = ?";
params.add(Long.parseLong(keyword));
}else {
whereSql = "from Order a,Ticket b,Attractions c where a.ticketId=b.id and b.jdId = c.id and c.name like ? ";
params.add("%" + keyword + "%");
}
} else {
whereSql = "from Order";
}
//如果订单状态不为空
if(orderStatus != null && !orderStatus.equals(-1)){
whereSql +=" and orderStatus = ?";
params.add(orderStatus);
}
//如果门票状态不为空
if(ticketStatus !=null && !ticketStatus.equals(-1)){
whereSql +=" and ticketStatus = ?";
params.add(ticketStatus);
}