总之就是在使用mybaties时,把检索参数是DATE型时,死都检索不到数据,后来知道new Date()和从数据库检索出来的date型的数据的日期的格式不一样,根本=不起来,只要加上 jdbcType=DATE 就好了。
eg:
select id from food where startDate = #{startDate};
改成
select id from food where startDate = #{startDate, jdbcType=DATE};
总之就是在使用mybaties时,把检索参数是DATE型时,死都检索不到数据,后来知道new Date()和从数据库检索出来的date型的数据的日期的格式不一样,根本=不起来,只要加上 jdbcType=DATE 就好了。
eg:
select id from food where startDate = #{startDate};
改成
select id from food where startDate = #{startDate, jdbcType=DATE};