mybatis.xml文件判断int、Date类型是否为空时报Cause: java.lang.IllegalArgumentException错

发布时间 2023-04-26 17:06:19作者: 小羊爱吃草!

mybatis.xml中判断Date、int类型字段是否为空值报错

错误的:

<if test="payType!=null and payType!=''">
     n.pay_type=#{payType}
</if>
<if test="startOrderTime!=null and startOrderTime!=''">
     and n.start_order_time = #{startOrderTime}
</if>

正确的:

<if test="payType!=null">
     n.pay_type=#{payType}
</if>
<if test="startOrderTime!=null ">
     and n.start_order_time = #{startOrderTime}
</if>