mybati内sql查询语句在两个日期内

装载自:

  http://blog.csdn.net/u010442302/article/details/72902441?locationNum=9&fps=1

 
<select id="selectByParamCount" resultType="java.lang.Integer"
parameterType="com.sss.fin.cif.vo.admin.BankCardAuditQuery">
select count(1) from tablename
<where>
<if test="operatorDateStart != null and operatorDateStart !='' " >
operator_date >= #{operatorDateStart,jdbcType=VARCHAR}
</if>
<if test="operatorDateEnd != null and operatorDateEnd !='' " >
<![CDATA[
and operator_date <= concat(#{operatorDateEnd,jdbcType=VARCHAR},'235959')
]]>
</if>
</where>
</select>

<![CDATA[ ]]> 转义< (小于号)
sql语句中,默认把yyyyMMdd定位成该日期的零点整
 
1
原文地址:https://www.cnblogs.com/rzqz/p/7306542.html