<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>
sql 查询每天大于某个时间点的数据
select * from ( select bbb.action_id, aaa.image_id, aaa.version, aaa.create_time, aaa.marker_id, aaa.label_duration_second, DATE_FORMAT(aaa.create_time,‘%H‘) time from t_shelf_label_history aaa inner JOIN t_shelf_image bbb ON aaa.image_id = bbb.id and bbb.owner_id = 2265 where aaa.create_time > "2018-10-1" AND aaa.create_time < "2018-10-31" ) demo where time > 20
yBatis中大于和小于号的转义写法
2018年09月10日 11:01:21 月下泛舟 阅读数:5629
mybatis 中 SQL 写在mapper.xml文件中,而xml解析 < 、>、<=、>= 时会出错,这时应该使用转义写法。
方式一
< <= > >= & ‘ "
< <= > >= & ' "
示例:
num >= #{num}
命名由来(gt、lt):
方式二
<![CDATA[ sql语句 ]]>
示例:
num <![CDATA[ >= ]]> #{num}
原文地址:https://www.cnblogs.com/xiaoshen666/p/10772244.html