} /*int flag=Integer.parseInt(request.getSession().getAttribute("lim").toString()); System.out.println("fffffffffffffffffffffffffffff"); System.out.println(flag); if (flag==1) { return new ActionForward("/flight_info_1.jsp"); }else if (flag==2) { return new ActionForward("/flight_info_2.jsp"); }else if (flag==3) { return new ActionForward("/flight_info_3.jsp"); }*/ return new ActionForward("/flight_info.jsp"); }
public Map searchFlightChangeInfoFenye(Map paramMap) { // TODO Auto-generated method stub
String hqlcount="select count(*) from TbFlightChangeInfo where 1=1 "; String hqlString="from TbFlightChangeInfo where 1=1 "; System.out.println("]]]]]]]]]]]");
//定义数组接收查询参数 List values=new ArrayList();
//判断公司名称是否具备例如查询条件 if (voyage_company!=null && voyage_company.length()>0) { hqlString=hqlString+" and voyageCompany like ? "; hqlcount=hqlcount+" and voyageCompany like ? "; values.add(voyage_company+"%"); } //判断操作者是否具备例如查询条件 if (handlerString !=null && handlerString.length()>0) { hqlString=hqlString+" and handler=?"; hqlcount=hqlcount+" and handler=?"; values.add(handlerString); } //判断输入手机号码是否具备例如查询条件 if (receive_cellphoneString !=null && receive_cellphoneString.length()>0) { hqlcount=hqlcount+" and receiveCellphone=? "; hqlString=hqlString+" and receiveCellphone=? "; values.add(receive_cellphoneString); } //判断状态是否具备例如查询条件 if (flight_state != -1) { hqlString=hqlString+" and flightState=? "; hqlcount=hqlcount+" and flightState=? "; values.add(flight_state); } //判断操作时间是否具备例如查询条件 if (handle_time!=null) { hqlString=hqlString+" and handleTime=?"; hqlcount=hqlcount+" and handleTime=?"; values.add(handle_time); } //判断接收时间是否具备例如查询条件 if (accept_time!=null && accept_time02!=null) { hqlString=hqlString+" and receiveTime between ? and ?"; hqlcount=hqlcount+" and receiveTime between ? and ?"; values.add(accept_time); values.add(accept_time02); } else if (accept_time!=null && accept_time02==null) { hqlString=hqlString+" and receiveTime >= ?"; hqlcount=hqlcount+" and receiveTime >= ?"; values.add(accept_time);
} else if (accept_time==null && accept_time02!=null) { hqlString=hqlString+" and receiveTime <= ?"; hqlcount=hqlcount+" and receiveTime <= ?"; values.add(accept_time02); }
if (values.size()>0) { System.out.println("values.size()"+values.size()); for (int i = 0; i < values.size(); i++) { queryCount.setParameter(i,values.get(i)); query.setParameter(i,values.get(i));
}
} /*String hql2="from TbFlightChangeInfo"; List list0= getHibernateTemplate().find(hql2); System.out.println("query2.uniqueResult():"+list0.size());*/ //总条数 // List sumList=getHibernateTemplate().find(hql2); // int sum=sumList.size(); Object countObject =queryCount.uniqueResult(); int sum = Integer.parseInt(countObject.toString()); System.out.println("sum:"+sum); //总页数 int count=sum%size==0?sum/size:sum/size+1; System.out.println("count:"+count); //越界检查 if (page<1) { page=1; } if (page>count) { page=count; }
//查 query.setFirstResult((page-1)*size).setMaxResults(size); List list=query.list();