NutzCN Logo
问答 自定义的sql,怎么做分页?
发布于 2477天前 作者 qq_25a1fb1a 1261 次浏览 复制 上一个帖子 下一个帖子
标签:

前台ajax:
"ajax": {
"url": "${base}/platform/oms/task/dataTable1",
"type": "post",
"dataType":'json',
success:function(json){
var nextDate = new Date();
nextDate.setHours(23);
nextDate.setMinutes(59);
nextDate.setSeconds(59);
var div1 = document.getElementById('tb1');
var code = '';
$.each(json,function (i,ele) {
var newDate = new Date();
newDate.setTime(ele.daytime * 1000);
var time = newDate.format('yyyy-MM-dd hh:mm:ss')
code += ''+ele.stationname+''+ele.typename+''+ele.scount+' ';
})
div1.innerHTML = code;
div1.style.fontWeight="normal";//取消加粗
}
}
Controller层:
@At("/dataTable1")
@Ok("json")
@RequiresPermissions("platform.oms.task.datatable")
public Object dataTable1() {
List list=omsTaskService.CountByStationType();
return list;
}
ServiceImpl层:
@Override
public List CountByStationType() {
Sql sql = Sqls.create("select s.name stationname,k.* from (SELECT t.stationId, t.type ,t.deadline daytime, count(*) scount from oms_task t GROUP BY t.stationId, t.type ORDER BY t.stationId,t.type)k,oms_station s where k.stationId=s.id");
Entity entity = dao().getEntity(Record.class);
sql.setEntity(entity);
sql.setCallback(Sqls.callback.entities());
dao().execute(sql);
List list = sql.getList(Record.class);
return list;
}

1 回复
添加回复
请先登陆
回到顶部