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>
相关推荐
Moe4881 天前
合并Pdf、excel、图片、word为单个Pdf文件的工具类(拿来即用版)
java·后端
oliveira-time1 天前
原型模式中的深浅拷贝
java·开发语言·原型模式
进阶的猿猴1 天前
easyExcel实现单元格合并
java·excel
小许学java1 天前
MySQL-触发器
java·数据库·mysql·存储过程·触发器
JEECG低代码平台1 天前
【2025/11】GitHub本月热度排名前十的开源Java项目
java·开源·github
百***86051 天前
Spring BOOT 启动参数
java·spring boot·后端
跟着珅聪学java1 天前
Spring Boot 中整合 MySQL 并打印 SQL 日志
java·spring boot
ᐇ9591 天前
Java集合框架实战:HashMap与HashSet的妙用
java·开发语言
阿智智1 天前
用Maven的quickstart archetype创建项目并结合JUnit5单元测试
java·单元测试·maven·junit5
乂爻yiyao1 天前
设计模式思想——从单例模式说起
java·单例模式·设计模式