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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM