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>
相关推荐
要开心吖ZSH4 分钟前
处方物流信息同步优化:从 36 秒到亚秒级的踩坑记录
java·数据库·mysql·性能优化
Wang's Blog6 分钟前
JavaWeb快速入门: MyBatis入门与实战
java·mybatis
EntyIU20 分钟前
Java NIO 实战
java·开发语言·nio
二宝哥21 分钟前
springboot项目使用Gradle工具实现依赖版本控制
java·spring boot·后端·gradle·版本
济*沧*海42 分钟前
Set集合深度解析:原理、特性与应用场景全攻略
java
geovindu42 分钟前
java: Singleton Pattern
java·开发语言·后端·单例模式·设计模式·创建型模式
一路向北North1 小时前
Spring Security OAuth2.0(16):密码模式
java·后端·spring
水无痕simon1 小时前
5 多表操作
java·开发语言·数据库
ALex_zry1 小时前
C++26 Freestanding 库扩展详解:无操作系统也能用标准库
java·jvm·c++
Tian_Hang1 小时前
Eclipse Mosquitto 安装及介绍
java·运维·服务器·ide·sql·mysql·eclipse