字符串传入的参数被转成了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乱转类型
发表评论 取消回复