mybatis中查询小技巧
1、 查询条件为String类型时,需要使用模糊查询,like concat
例如:
<if test
="stockManager!=null and !stockManager.trim.isEmpty">
and stock_manager LIKE CONCAT
('%',#
{stockManager
,jdbcType
=VARCHAR
},'%')
</if>
2、报错Caused by: com.mysql.cj.exceptions.DataReadException: Zero date value prohibited
解决办法:
这是因为查询的时间在数据库中为0000:00:00,解决方法是在application.properties的数据库连接spring.datasource.url:后添加&zeroDateTimeBehavior=convertToNull