首页 > 其他分享 >手动实现分页查询(菜鸟版)

手动实现分页查询(菜鸟版)

时间:2023-05-21 17:44:05浏览次数:37  
标签:username map pageNum 分页 菜鸟 手动 total data email

public Map<String,Object> selectPage(Integer pageNum, Integer pageSize,String username,String email,String address) {

    // 拼接sql
    username = "%"+username+"%";
    email = "%"+email+"%";
    address = "%"+address+"%";

    // 计算当前页
    pageNum = (pageNum - 1) * pageSize;
    List<User> data = userMapper.selectPage(pageNum, pageSize,username,email,address);
    Integer total = userMapper.selectTotal();

    /*
        data 存放json数据
        total 记录整个表的总条数
     */
    Map<String,Object> map = new HashMap<>();
    map.put("data",data);
    map.put("total",total);

    return map;
}

 

标签:username,map,pageNum,分页,菜鸟,手动,total,data,email
From: https://www.cnblogs.com/qijiangforever/p/17418880.html

相关文章