Mybatis的if test字符串比较问题

最初代码:
<update id="updateCollectionStatus">
update test_collection <choose>
<when test="delFlag == '1'.toString()">
set del_flag='0'
</when>
<otherwise>
set del_flag='1'
</otherwise>
</choose>
where test_id=#{testId}and user_id=#{userId}
</update>
 
结果:一直执行otherwise标签中的方法:
解决方法:
<update id="updateCollectionStatus">
update test_collection <choose>
<when test="delFlag == '1'.toString()">
set del_flag='0'
</when>
<otherwise>
set del_flag='1'
</otherwise>
</choose>
where test_id=#{testId}and user_id=#{userId}
</update>
参考内容:
https://code.google.com/p/mybatis/issues/detail?id=262

posted on 2016-09-18 23:56  xu_xiang  阅读(11900)  评论(1编辑  收藏  举报

导航