// 分页
@At
@Ok("json")
public NutMap MessageList(int pagenumber,int selectNumberSize,Date beginDate,Date endDate) {
List<NutMap> time = new LinkedList<NutMap>();
//初始化分页Pager对象
if (pagenumber == 0) {
pagenumber = 1;
}
Pager pager = adminService.dao().createPager(pagenumber, selectNumberSize);
Criteria cri = Cnd.cri();
if(!beginDate.equals("")) {
cri.where().and("pushtime",">=",beginDate);
}
if(!endDate.equals("")) {
cri.where().and("pushtime","<=",endDate);
}
//cri.where().andBetween("pushtime", beginDate, endDate);
System.out.println("sql:"+cri.toString());
List<Message> messages = messageService.dao().query(Message.class,cri,pager);
for(Message message : messages) {
NutMap map = new NutMap();
map.addv("message", message);
time.add(map);
}
System.out.println("time:"+time.size());
pager.setRecordCount(adminService.dao().count(Message.class, cri));
return NutMap.NEW().addv("time",time).addv("totalpages", pager.getPageCount()).addv("pagenumber", pagenumber);
}
6 回复
该怎么写呢 貌似是jsp那里读不到字段
============
function getMessageList(pagenumber){
var selectNumberSizeVal = $("#selectNumberSize").val();
var begin = $("#begin").val();
var finish = $("#finish").val();
$.ajax({
url : baseUrl + "MessageList",
data : {
pagenumber : pagenumber,
selectNumberSize : selectNumberSizeVal,
beginDate : begin,
endDate : finish
},
success : function(data) {
console.log("data.time:"+data.time);
//$('.message_push').empty();
if(data.time != ""){
var html = render('#template-daoru', data.time);
$('#table-daoru').html(html);
//分页
$('#pagination').twbsPagination('destroy');
$('#pagination').twbsPagination({
totalPages : data.totalpages,
visiblePages : 5,
startPage : data.pagenumber,
first : '首页',
prev : '上一页',
next : '下一页',
last : '末页',
onPageClick : function(event, page) {
if (data.pagenumber && data.pagenumber != page) {
getMessageList(page);
}
}
});
=================================
<script id="template-daoru" type="x-handlebars-template">
{{#each this}}
<tr>
<td><input type="radio" name="historymessage" id="history_{{id}}" value="{{id}}" checked=""></td>
<td><span id="toUser_{{id}}" data-touser="{{toUser}}" data-typeid="{{pushTypeId}}">{{toUserName}}</span></td>
<td id="content_{{id}}">{{content}}</td>
<td>{{pushTime}}</td>
</tr>
{{/each}}
</script>
添加回复
请先登陆