mybatis中Date或者Time是stamp不能与空字符串""比较,会抛异常
解决方案: 只要null判断。
<!-- Date或者Time是stamp不能与空''字符串比较,会抛异常 -->
<if test="startDate != null and endDate != null" >
and MARKETDATE between #{startDate} and #{endDate}
</if>
解决方案:
入参做校验,如果date或time是空字符串,设置为null即可。代码如下:
String date="";
if(StringUtils.isBlank(date)){
date=null;
}
不支持localDAteTime的问题
待续