补上一张进入query方法后得到参数的图

解决方案 »

  1.   

    请参考, MyBatis 物理分页foreach 参数失效  http://fred-han.iteye.com/blog/1771395
      

  2.   


                 //分页
                 if (dialect.supportsLimit() && (offset != RowBounds.NO_ROW_OFFSET || limit != RowBounds.NO_ROW_LIMIT)) {
                         BoundSql boundSql = ms.getBoundSql(parameter);
                         String sql = boundSql.getSql().trim();
                         if (dialect.supportsLimitOffset()) {
                                 sql = dialect.getLimitString(sql, offset, limit);
                                 offset = RowBounds.NO_ROW_OFFSET;
                         } else {
                                 sql = dialect.getLimitString(sql, 0, limit);
                         }
                         limit = RowBounds.NO_ROW_LIMIT;                     queryArgs[ROWBOUNDS_INDEX] = new RowBounds(offset, limit);
                         BoundSql newBoundSql = new BoundSql(ms.getConfiguration(), sql, boundSql.getParameterMappings(),
                          boundSql.getParameterObject());
                         
                         MappedStatement newMs = copyFromMappedStatement(ms, new BoundSqlSqlSource(newBoundSql), false);
                         queryArgs[MAPPED_STATEMENT_INDEX] = newMs;
                         if(logger.isDebugEnabled()) {
                                 logger.debug("sql = \n" + sql);
                         }
                 }