Oracle 數據庫,查詢增加RowBounds限制查詢條數,默認是0到1000條
private final static int rowLimit = 1000; //限制查詢條數 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; }以上所述是小編給大家介紹的Mybatis RowBounds 限制查詢條數的實現代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林網網站的支持!
新聞熱點
疑難解答