Se pasa una comparación no válida de tipo de fecha en Mybits: java.util.Date y java.lang.String

Se informa de un error cuando se pasa el tipo de fecha en Mybits

Causado por: java.lang.IllegalArgumentException: comparación no válida: java.util.Date y java.lang.String
Cuando usamos el tipo de fecha como parámetro para pasar, Mybatis si la verificación para el tipo de fecha no puede verificar si está vacío string (''), solo puede verificar si está vacío (nulo), el newTime en el mapeador a continuación es de tipo Date.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="qlj.bids.dao.BidsMapper">
    <!-- 查询除大文本以外的数据  -->
  <select id="selectBidsList" resultType="qlj.bids.model.Bids"> 
    select title,newTime,id
    from bids
    <where>
        <if test="bids != null">
            <if test="bids.title != null and bids.title !=  '' ">
                    title like  CONCAT("%",#{bids.title},"%") 
            </if>
            <if test="bids.newTime!= null ">
                    AND newTime = #{bids.newTime} 
            </if>
  </select>
</mapper>

Supongo que te gusta

Origin blog.csdn.net/Qin_HongKun/article/details/80625339
Recomendado
Clasificación