mybatis,mysql query based on date


The field column of the database table is paymentDate varchar type, the parameter time period paymentDateBegin , paymentDateEnd 


<if test=" paymentDateBegin !=null and paymentDateBegin !=''">

<![CDATA[
      and DATE_FORMAT(a.paymentDate, '%Y-%m-%d') >=  DATE_FORMAT(#{paymentDateBegin}, '%Y-%m-%d')
]]>
</if>

<if test=" paymentDateEnd !=null and paymentDateEnd !=''">
<![CDATA[
      and DATE_FORMAT(a.paymentDate, '%Y-%m-%d') <=  DATE_FORMAT(#{paymentDateEnd}, '%Y-%m-%d')
]]>
</if>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325607991&siteId=291194637