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>
相关推荐
侠客行031712 小时前
Mybatis连接池实现及池化模式
java·mybatis·源码阅读
蛇皮划水怪12 小时前
深入浅出LangChain4J
java·langchain·llm
老毛肚14 小时前
MyBatis体系结构与工作原理 上篇
java·mybatis
风流倜傥唐伯虎14 小时前
Spring Boot Jar包生产级启停脚本
java·运维·spring boot
Yvonne爱编码14 小时前
JAVA数据结构 DAY6-栈和队列
java·开发语言·数据结构·python
Re.不晚14 小时前
JAVA进阶之路——无奖问答挑战1
java·开发语言
你这个代码我看不懂15 小时前
@ConditionalOnProperty不直接使用松绑定规则
java·开发语言
fuquxiaoguang15 小时前
深入浅出:使用MDC构建SpringBoot全链路请求追踪系统
java·spring boot·后端·调用链分析
琹箐15 小时前
最大堆和最小堆 实现思路
java·开发语言·算法
__WanG15 小时前
JavaTuples 库分析
java