页面代码:
姓名学历技能经验住址联系方式
${res}${data}于千万年之中时间的无涯的荒野里…时间的无涯的荒野里…--%>
js代码
//加载完成
$(function(){
var sherchkey='${positioninfo.name}';
savePosition();//保存修改方法
getPeopleList(1,5,sherchkey);//获取人才列表
// getPageList(); //分页方法
});
//自己封装获取数据方法
function getPeopleList(crr,lmt,searchKey){
//获取人才列表
$.ajax({
url:'${ctx}/recruit/peoplelist',
type:'post',
data:{
"curr":crr||1,
"pageSize":lmt||5,
"searchKey":searchKey
},
dataType:'json',
success:function(res){
if(res.success=="success"){
console.log(res);
count=res.data.totalElements;//总记录
curr=res.data.number; //当前页
limit=res.data.size; //每页几个
var rclist=res.data.content;
var html='';
var len=rclist.length;
for (var i=0; i
var htmlbuf='
'+'
'+rclist[i].name+''+'
'+rclist[i].edu+''+'
'+rclist[i].skill+''+'
'+rclist[i].exp+''+'
'+rclist[i].add+''+'
'+rclist[i].tel+''+'
';html=html+htmlbuf;
}
$("#rcktb").html(html);
//调用分页方法
getPageList(count,curr,limit,searchKey);
}else {
layer.alert(res.message);
}
},
error:function(){
layer.msg("网络故障");
}
})
}
//自己封装分页方法
function getPageList(count,curr,limit,searchKey){
//分页方法
layui.use(['laypage', 'layer'], function(){
var laypage = layui.laypage
,layer = layui.layer;
//完整功能
laypage.render({
elem: 'pagefenye',
count: count||0,
theme: '#009587',
limit : limit||3,
limits:[5, 10, 20, 30, 40],
curr : curr||1,
layout: ['count', 'prev', 'page', 'next', 'refresh', 'skip'],
jump: function(obj,first){
//debugger;
if(!first){
//window.location.href = "?curr="+obj.curr+"&pageSize="+obj.limit+"&enterId="+'${enterId}';
getPeopleList (obj.curr,obj.limit,searchKey);
}
}
});
});
}
后台代码
/**
*
* @param curr
* @param pageSize
* @param searchKey
* @param enterId
* @param model
* @return
*/
@RequestMapping("/peoplelist")
@ResponseBody
public ResultEntity peopleList(@RequestParam(value = "curr", defaultValue = "1") int curr,
@RequestParam(value = "pageSize", defaultValue = "5") int pageSize,String searchKey,Model model){
ResultEntity res = new ResultEntity();
try {
PageUtils pageUtils = new PageUtils(curr, pageSize, "", "");
Page>> list = recruitService.getPeopleList(searchKey, pageUtils);
List> dataList = (List>) list.getData();
PageVo pageVo = new PageVo(list.getCurrentPageNo() - 1, dataList, pageSize, list.getTotalPageCount(),
list.getTotalCount());
pageVo.setNumber(curr);
res.setData(pageVo);
//res.setData(curr);
//res.setData(enterId);
res.setSuccess("success");
res.setMessage("获取成功");
} catch (Exception e) {
e.printStackTrace();
res.setSuccess("false");
res.setMessage("获取失败");
}
return res;
}