We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
<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>
<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}
</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
``
The text was updated successfully, but these errors were encountered:
Hi @nySimple , Which version are you using? I look the same issue with #966.
Sorry, something went wrong.
to @kazuki43zoo
the version i used is 3.4.3. i got the issue, and it was fixed in 3.4.5 thanks
No branches or pull requests
<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
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
``
The text was updated successfully, but these errors were encountered: