**Controller:**
@GetMapping("/carTypeList")
public AjaxResult carTypeList(EntVo entVo) {
try {
Map<String, Object> result = regulatorySideService.carTypeList(entVo);
return AjaxResult.success(result);
} catch (Exception e) {
e.printStackTrace();
}
return AjaxResult.error("获取失败,请联系管理员");
}
**Service:**
public Map<String, Object> carTypeList(EntVo entVo) {
Map<String, Object> result = new HashMap<String, Object>();
result.put("carTypeList", new ArrayList<>());
//pageNum : 当前页码
//count : 每页显示数据量
IPage<RepairInfoVo> iPage = repairInfoService.getCarTypeList(pageNum, count);
if (iPage != null) {
List<RepairInfoVo> records = iPage.getRecords();
result.put("isNextPage", comminityService.isHaveNext((int) iPage.getTotal(), entVo.getPagenum(), entVo.getCont()));
result.put("carTypeList", records);
}
return result;
}
**ComminityService:**
//判断是否还有下一页,返回值:true/false
public boolean isHaveNext(Integer total, Integer pageNum, Integer pageSize) {
Integer remainder = total % pageSize;
Integer totalPage;
if (remainder.equals(0)) {
totalPage = total / pageSize;
} else {
totalPage = total / pageSize + 1;
}
if (pageNum < totalPage) {
return true;
} else {
return false;
}
}
分页功能 -- 判断是否有下一页
最新推荐文章于 2024-11-11 21:19:25 发布