黑马程序员技术交流社区
标题:
哪位大神帮我看一下这个分页有哪里不对
[打印本页]
作者:
看好时机向前冲
时间:
2016-3-21 11:13
标题:
哪位大神帮我看一下这个分页有哪里不对
@Override
public List<Object> getPageAnnouncement(Announcement announcement,Page page) {
if(announcement!=null){
StringBuffer sb=new StringBuffer("from Announcement where 1=1");
Map<String, Object> params=new HashMap<String, Object>();
if(announcement!=null){
if(announcement.getTitle()!=null&&!"".equals(announcement.getTitle())){
sb.append(" and title =:title");
params.put("title", announcement.getTitle());
}
if(announcement.getPublishtime()!=null){
sb.append(" and publishtime =:publishtime");
params.put("publishtime", announcement.getPublishtime());
}
}
Integer pageIndex = null;
Integer pageSize = null;
if(page!=null){
pageIndex = page.getPageIndex();
pageSize = page.getPageSize();
}
return dao.getobObjects(sb.toString(), params, pageIndex, pageSize);
}
return null;
}
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2