springboot+dubbo异常解决invalid comparison: java.util.Date and java.lang.String

    技术2022-07-11  105

    这是mybatis 3.3.0中对于时间参数进行比较时的一个bug. 如果拿传入的时间类型参数与空字符串’'进行对比判断则会引发异常. 所以在上面的代码中去该该判断, 只保留非空判断就正常了

    <if test="createTime != null and createTime !='' " > date(create_time) = date(#{createTime,jdbcType=TIMESTAMP}) </if>

    改为

    <if test="createTime != null"> date(create_time) = date(#{createTime,jdbcType=TIMESTAMP}) </if>
    Processed: 0.011, SQL: 12