1.oracle中使用的是to_char()或者to_date()函数
#beginTime和endTime都是String类型的"2022-02-01" <if test = "beginTime !=null and beginTime !='' "> AND TO_CHAR(CO.CREATE_TIME,'yyyy-mm-dd') <![CDATA[>=]]> #{beginTime} </if> <if test = "endTime !=null and endTime !='' "> AND TO_CHAR(CO.CREATE_TIME,'yyyy-mm-dd') <![CDATA[<=]]> #{endTime } </if>
2.mysql中使用的是DATA_FORMAT()
#beginTime和endTime都是String类型的"2022-02-01" <if test = "beginTime !=null and beginTime !='' "> AND DATE_FORMAT(c.CREATE_TIME,'%Y-%m-%d %H:%i:%s') <![CDATA[>=]]> #{beginTime} </if> <if test = "endTime !=null and endTime !='' "> AND DATE_FORMAT(c.CREATE_TIME,'%Y-%m-%d %H:%i:%s') <![CDATA[<=]]> #{endTime } </if>