简单分页查询
注意,limit分页查询必须得是 int ,如果是字符串会报错.
@Autowired
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Override
public List<Map<String, Object>> queryNoneSolve(String limit) {
if (StringUtils.isEmpty(limit)) {
limit = "10";
}
String sql = "SELECT id, trace_id, " +
"topic, tag, message_id, mq_body_content, trade_order_id, " +
"reverse_order_id, is_solve, is_del, create_time, update_time, features, retry_reasons " +
"FROM oms_order_mq_retry_upper_limit_log" +
" WHERE is_del = 0 AND is_solve = 0 LIMIT :limit ";
MapSqlParameterSource mapSqlParameterSource = new MapSqlParameterSource()
// 添加参数
.addValue("limit", Integer.valueOf(limit));
List<Map<String, Object>> maps = namedParameterJdbcTemplate.queryForList(sql, mapSqlParameterSource);
return maps;
}