protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<Object, Object> root = new HashMap<Object, Object>();
root.putAll(super.root);
Template temp = getConfiguration().getTemplate("messagerecord/MessageRecord.ftl");
RunTimeUser rtUser = RunTimeUser.getRunTimeUser(request);
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
IMessageRecordDao messageRecordDao = (IMessageRecordDao) ac.getBean("messageRecordDao");
String pageno = request.getParameter("pageno");
//处理当前页
if(pageno==null) {
pageno = "1";
}
int pagenum = 1;
try {
pagenum = Integer.parseInt(pageno);
} catch (Exception e1) {
pagenum = 1;
}
String sender = request.getParameter("sender");
String hql = " from MessageRecord m where 1=1 ";
if(!StringUtil.isEmptyStr(sender))
{
hql += " and m.sender like '%"+sender+"%'";
}
if(rtUser.isMerchant() || rtUser.isOrganization())
{
hql += " and m.sendId = '"+rtUser.getId()+"'";
}
hql += " order by m.id desc";
PageList page = messageRecordDao.findByPage4Report(hql, new Object[]{}, pagenum, 15);