Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForEachSqlNode put unexpected key-value to DynamicContext #1178

Closed
nySimple opened this issue Jan 22, 2018 · 2 comments
Closed

ForEachSqlNode put unexpected key-value to DynamicContext #1178

nySimple opened this issue Jan 22, 2018 · 2 comments

Comments

@nySimple
Copy link

nySimple commented Jan 22, 2018

<select id="getUser" resultType="org.apache.ibatis.submitted.nySimple">
select * from users
<where>
<if test="userIdList != null" >
and id in
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</if>
<if test="userId != null">
and id = #{userId}
</if>
</where>
</select>

and the param

    Map<String, Object> param = new HashMap();
  param.put("userIdList", Arrays.array(1,2));

then,i get the sql “select * from users where id in(1,2) and id = 2”.
but the second condition of "id = 2" should not exist

``

@nySimple nySimple changed the title ForEachSqlNode has bad ForEachSqlNode put unexpected key-value to DynamicContext Jan 22, 2018
@kazuki43zoo
Copy link
Member

Hi @nySimple , Which version are you using?
I look the same issue with #966.

@nySimple
Copy link
Author

to @kazuki43zoo

the version i used is 3.4.3.
i got the issue, and it was fixed in 3.4.5
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants