Mybatis 错误:Type handler was null on parameter mapping for property 'timeArray[0]' 解决方法
这个错误是因为在参数映射中找不到时间类型处理器。根据错误信息,'timeArray' 是一个 'java.util.Date' 类型的数组,但是没有指定它的 'jdbcType'。
要解决这个问题,你需要在参数映射中指定 'timeArray' 的 'jdbcType'。假设 'timeArray' 的元素是 'java.util.Date' 类型,你可以在参数映射中添加如下代码:
<if test="timeArray != null">
<if test="timeArray.length == 2">
and a.cuptime between #{timeArray[0], jdbcType=TIMESTAMP} and #{timeArray[1], jdbcType=TIMESTAMP}
</if>
<if test="timeArray.length == 1">
and a.cuptime = #{timeArray[0], jdbcType=TIMESTAMP}
</if>
</if>
这样就为 'timeArray' 指定了 'jdbcType' 为 'TIMESTAMP'。根据你的实际情况,可能需要将 'jdbcType' 替换为适合的时间类型,比如 'DATE' 或 'TIME'。
另外,确保你的应用程序中已经注册了相应的时间类型处理器,以便将 'java.util.Date' 转换为数据库支持的时间类型。
原文地址: https://www.cveoy.top/t/topic/i5x 著作权归作者所有。请勿转载和采集!