SELECT create_date AS auditCompanyNumber  FROM   t_account_enterprise a where a.certification_status='03'
<if test="#{0} != null and #{0} != ''and #{1} == null and #{1} == ''" >
and create_date BETWEEN #{0} AND #{1} 
</if>
明明#{0}和#{1}都是null,但是if条件里的继续执行,求教为什么?

解决方案 »

  1.   

    这里不用#{0}表示,直接用0表示就行,比如<if test="startTime != null and endTime != null">
    and create_date between #{startTime} and #{endTime}
    </if>
      

  2.   

    #{0}代表我传入的第一个String类型的参数
      

  3.   


    #{0}代表我传入String类型的第一个参数,如果直接用0什么都表示不了吧
      

  4.   


    #{0}代表我传入String类型的第一个参数,如果直接用0什么都表示不了吧
    就是我说的那样写的,怎么就不信呢,自己试下啊