zoukankan      html  css  js  c++  java
  • mybatis ---- 分页查询,,源码

     PageHelper 有封装的分页插件---直接用即可

    @GetMapping("/toDeptList")
    public BaseResponse toDeptList(Model model,@RequestParam(required = false,defaultValue = "1",value = "pn")Integer pn ) {
    BaseResponse response = new BaseResponse();
    try{
    PageHelper.startPage(pn, 15); //pn--页数,定值---每页的数量
    List<ReleaseBase> rbList = rbService.searchData(); //查询表里所有的数据
    PageInfo<ReleaseBase> p = new PageInfo<>(rbList);
    model.addAttribute("deptList", rbList);
    model.addAttribute("page", p);
    response.setData(rbList);
    response.setSuccess(true);
    return response;
    }catch (Exception e){
    response.setErrorMsg(ErrorCode.SYSTEM_ERROR.getDesc());
    }
    return response;
    }

    sql ://根据需求要求条件查询
    @Select(" SELECT  rb.*,cp.scale  FROM release_base rb,company cp WHERE  rb.is_bid LIKE '%${is_bid}%' AND rb.live LIKE '%${live}%' AND rb.education LIKE '%${education}%' AND rb.bounty LIKE '%${bounty}%' AND rb.num LIKE '%${num}%' AND rb.type like '%${type}%' AND rb.creat_time LIKE '%${creat_time}%' AND cp.scale LIKE '%${scale}%' and rb.category_name LIKE '%${category_name}%' group  by  creat_time  ")
    List<ReleaseBase> searchData();
  • 相关阅读:
    css 面试学习
    关于CSS的图像放大问题的解决,需要借助jQuery等直接用css3设置
    DEBUG使用
    crontab
    od
    dumpe2fs
    mke2fs
    dd
    GDB
    rm
  • 原文地址:https://www.cnblogs.com/Darkqueen/p/10536641.html
Copyright © 2011-2022 走看看