mybatis离谱bug乱转类型

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

@Param("online") String online
			<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类型。
需要这样判断:

			<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>

相关推荐

  1. mybatis离谱bug类型

    2024-06-06 03:50:02       27 阅读
  2. mybatis条件构造bug

    2024-06-06 03:50:02       28 阅读
  3. Mybatis配置-类型别名(typeAliases)

    2024-06-06 03:50:02       56 阅读
  4. QStringstring中文码问题解决

    2024-06-06 03:50:02       28 阅读
  5. MyBatis(17)MyBatis 如何处理枚举类型

    2024-06-06 03:50:02       25 阅读
  6. springboot集成mybatis处理json类型

    2024-06-06 03:50:02       60 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-06 03:50:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-06 03:50:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-06-06 03:50:02       87 阅读
  4. Python语言-面向对象

    2024-06-06 03:50:02       96 阅读

热门阅读

  1. AcWing 841. 字符串哈希——算法基础课题解

    2024-06-06 03:50:02       34 阅读
  2. 基于学习的决策树

    2024-06-06 03:50:02       31 阅读
  3. spark SQL优化器catalyst学习

    2024-06-06 03:50:02       32 阅读
  4. deque

    deque

    2024-06-06 03:50:02      30 阅读
  5. 关于焊点检测SJ-BIST)模块实现

    2024-06-06 03:50:02       30 阅读
  6. 日常实习-小米计算机视觉算法岗面经

    2024-06-06 03:50:02       35 阅读
  7. 【Golang】go语言写入数据并保存Excel表格

    2024-06-06 03:50:02       27 阅读
  8. 054、Python 函数的概念以及定义

    2024-06-06 03:50:02       33 阅读
  9. 【安卓配置WebView以允许非HTTPS页面访问摄像头】

    2024-06-06 03:50:02       31 阅读