本文主要是介绍mybatis离谱bug乱转类型,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
字符串传入的参数被转成了int:
@Param("online") String online
<if test="online == '0'">and (heart_time is null or heart_time <![CDATA[ < ]]> UNIX_TIMESTAMP(SUBDATE(now(),INTERVAL 8 MINUTE)) )</if><if test="online == '1'">and heart_time is not null and heart_time >= UNIX_TIMESTAMP(SUBDATE(now(),INTERVAL 8 MINUTE))</if>
以上代码,既不进online == '0'
也不进online == '1'
,因为被mybatis转成了int类型。
需要这样判断:
<if test="online == 0">and (heart_time is null or heart_time <![CDATA[ < ]]> UNIX_TIMESTAMP(SUBDATE(now(),INTERVAL 8 MINUTE)) )</if><if test="online == 1">and heart_time is not null and heart_time >= UNIX_TIMESTAMP(SUBDATE(now(),INTERVAL 8 MINUTE))</if>
这篇关于mybatis离谱bug乱转类型的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!