1、xml的sql配置:
<select id="get" resultType="java.util.Map" statementType="CALLABLE">
{call proc_nifi_user(
#{map.tableName,mode=IN,jdbcType=VARCHAR},
#{map.page,mode=IN,jdbcType=INTEGER},
#{map.pageSize,mode=IN,jdbcType=INTEGER},
#{map.total,mode=OUT,jdbcType=INTEGER},
#{map.totalPage,mode=OUT,jdbcType=INTEGER})}
</select>
2、mapper接口:
public List<Map<String,Object>> get(@Param("map") Map<String, Object> map);
3、controller实现:
/**
* 查询
*/
@GetMapping("tableList")
public R tableList(String tableName)
{
Map<String, Object> 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<Map<String,Object>> 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"));
}