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();
  • 相关阅读:
    Struts2概述
    Oracle Multitenant Environment (二) Purpose
    Oracle Multitenant Environment (一) About
    oracle 12c之前用sequence 和 trigger来生成自动增长的列
    EPEL reporsitory
    optimizer_index_cost_adj
    oracle rac cache fusion
    一个oracle bug
    django book chapter 2
    linux 中文乱码问题
  • 原文地址:https://www.cnblogs.com/Darkqueen/p/10536641.html
Copyright © 2011-2022 走看看