mybatis离谱bug乱转类型

字符串传入的参数被转成了int:

java 复制代码
@Param("online") String online
xml 复制代码
			<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类型。

需要这样判断:

xml 复制代码
			<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>
相关推荐
sunnyday04263 分钟前
MyBatis XML映射文件中的批量插入和更新
xml·java·mysql·mybatis
程序员阿鹏11 分钟前
jdbc批量插入数据到MySQL
java·开发语言·数据库·mysql·intellij-idea
莲动渔舟12 分钟前
国产编辑器EverEdit - 在编辑器中对文本进行排序
java·开发语言·编辑器
martian6651 小时前
【Java高级篇】——第16篇:高性能Java应用优化与调优
java·开发语言·jvm
m0_748250031 小时前
springboot使用logback自定义日志
java·spring boot·logback
-优势在我1 小时前
Android TabLayout 实现随意控制item之间的间距
android·java·ui
Lojarro1 小时前
JavaEE基础之- Servlet相关
java·servlet·java-ee
考虑考虑1 小时前
MyCat2使用
java·后端·java ee
KingDol_MIni1 小时前
Spring Boot 集成 T-io 实现客户端服务器通信
java·服务器·spring boot
许苑向上2 小时前
Java八股文(下)
java·开发语言