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>
相关推荐
Themberfue1 小时前
Redis ⑦-set | Zset
java·开发语言·数据库·redis·sql·缓存
mozun20203 小时前
VS BUG(6) LINK : fatal error LNK1158: 无法运行“rc.exe”
c++·bug·vs·链接器·资源文件
此木|西贝4 小时前
【设计模式】享元模式
java·设计模式·享元模式
李少兄5 小时前
解决Spring Boot多模块自动配置失效问题
java·spring boot·后端
bxlj_jcj6 小时前
JVM性能优化之年轻代参数设置
java·性能优化
八股文领域大手子6 小时前
深入理解缓存淘汰策略:LRU 与 LFU 算法详解及 Java 实现
java·数据库·算法·缓存·mybatis·哈希算法
不当菜虚困6 小时前
JAVA设计模式——(八)单例模式
java·单例模式·设计模式
m0_740154676 小时前
Maven概述
java·maven
吗喽对你问好6 小时前
Java位运算符大全
java·开发语言·位运算