Mybatis RowBounds implementation code that limits the number of query bars
- 2020-05-17 05:35:29
- OfStack
Oracle database, increase the number of RowBounds restricted query bars, default is 0 to 1000 bars
private final static int rowLimit = 1000;
// Limit the number of query bars
private final static RowBounds QUERY_LIMIT=new RowBounds(0,rowLimit);
public List<T> select(String sqlID, T t) throws DBException,
RecordNotFoundException {
List<T> ret;
try {
if ("".equals(sqlID) || (null == sqlID)) {
ret = getSqlSession().selectList(t.getMapperName() + SELECT, t,QUERY_LIMIT);
} else {
ret = getSqlSession().selectList(t.getMapperName() + MAPPER + sqlID,
t,QUERY_LIMIT);
}
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
LOGGER.debug(t.toString());
throw new DBException(e);
}
if (ret == null && checkNull) {
throw new RecordNotFoundException(t.getTableName());
}
return ret;
}