mybatis调用mysql分页存储过程

1、xml的sql配置:

    

2、mapper接口:

public List> get(@Param("map") Map map);

3、controller实现:

	/**
	 * 查询
	 */
	@GetMapping("tableList")
	public R tableList(String  tableName)
	{
		Map params = new HashMap<>();
		params.put("tableName", tableName);
		params.put("fields", "*");
		params.put("page", Integer.parseInt(getRequest().getParameter("pageNum")));
		params.put("pageSize", Integer.parseInt(getRequest().getParameter("pageSize")));
		params.put("total", 0);
		params.put("totalPage", 0);
		List> maps = dbTableService.get(params);
        //将单个的返回值传到入参的map
		System.out.println(params);
        return R.data(null).put("rows", maps).put("total", 
        params.get("total")).put("pageNum", params.get("totalPage"));
	}

 

你可能感兴趣的:(mybatis)