title: Mybatis mapper file, parameter was changed to null in foreach statement
body: <p>Okay, I am trying to generate sql for a <code>Map&lt;String,List&lt;String&gt;&gt;</code>, I am having a nested foreach statements to generate sql. This is my mybatis xml mapper file:</p>
  
  <pre><code>&lt;select id="UserScaleResult.listAccordingToScaleBrief" resultType="java.util.Map"&gt;
      select distinct uu.id as uid, uu.fullname, ucn.card_number,
      uu.mobile_number
  
      from
      &lt;include refid="UserScaleResult.baseCondition.from" /&gt;
      &lt;include refid="UserScaleResult.UserType.from"/&gt;
      &lt;include refid="UserScaleResult.listAccordingToScale.from"/&gt;
      &lt;include refid="UserScaleResult.baseConditions.where" /&gt;
      &lt;include refid="UserScaleResult.UserType.where" /&gt;
      &lt;include refid="UserScaleResult.listAccordingToScale.where" /&gt;
      limit #{offset}, #{pageSize}
  &lt;/select&gt;
  
  
  &lt;sql id="UserScaleResult.listAccordingToScale.where"&gt;
      &lt;if test="@Ognl@isNotEmpty(type)"&gt;
          and musr.type = #{type}
      &lt;/if&gt;
      &lt;if
          test="@Ognl@isNotEmpty(createTimeBegin) and @Ognl@isNotEmpty(createTimeEnd)"&gt;
          and musr.create_time between #{createTimeBegin} and
          #{createTimeEnd};
      &lt;/if&gt;
      &lt;if test="@Ognl@isNotEmpty(missionId)"&gt;
          and musr.mission_id = #{missionId}
      &lt;/if&gt;
      &lt;if test="@Ognl@isNotEmpty(scaleId)"&gt;
          and musr.scale_id = #{scaleId}
      &lt;/if&gt;
      &lt;if test="@Ognl@isNotEmpty(sdl)"&gt;
          and (
          &lt;foreach collection="sdl.entrySet()" item="item" open="(" separator=") or (" close=")"&gt;
          tsrdl.dimension_id = #{item.key} 
              &lt;if test="@Ognl@isNotEmpty(item.value)"&gt;
                  and 
                  &lt;foreach collection="item.value" item="iitem" open="(" separator=" or " close=")"&gt;
                      tsrdl.level_id = #{iitem}
                  &lt;/foreach&gt;
              &lt;/if&gt;
          &lt;/foreach&gt;
          )
      &lt;/if&gt;
  &lt;/sql&gt;
  </code></pre>
  
  <p>The log shows the #{iitem} are all null when it put it down to sql, although the number of parameters are correct:</p>
  
  <pre><code>2016-05-13 14:47:27,837 DEBUG [java.sql.Connection] - &lt;==&gt;  Preparing: select count(*) from user_user uu left join user_user_detail uud on uu.id = uud.user_id left join user_card_number ucn on uu.card_number_id =ucn.id left join org_org oo on ucn.org_id = oo.id inner join (SELECT user_id, MAX(IF(extension_item_id=?,DATA,'') )AS ? FROM user_extension_item_data GROUP BY user_id) AS ud on uu.id = ud.user_id inner join mission_user_scale_result musr on uu.id = musr.user_id inner join test_scale ts on musr.scale_id = ts.id inner join test_scale_result_dimension_level tsrdl on tsrdl.result_id = musr.id and ud.3 = ? and ( ( tsrdl.dimension_id = ? and ( tsrdl.level_id = ? or tsrdl.level_id = ? ) ) or ( tsrdl.dimension_id = ? and ( tsrdl.level_id = ? or tsrdl.level_id = ? or tsrdl.level_id = ? ) ) ) &gt;
  2016-05-13 14:47:27,838 DEBUG [java.sql.PreparedStatement] - &lt;==&gt; Parameters: 3(String), 3(String), 保密(String), 42(String), null, null, 47(String), null, null, null&gt;
  </code></pre>
  
  <p>EDIT:
  Just did some experiment, when I substitute the <code>'#'</code> sign in <code>#{iitem}</code> with <code>'$'</code>, the value appears and the sql gets parameters all good. </p>