zoukankan      html  css  js  c++  java
  • mybatis中添加时间字符串条件

    <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解析 < 、>、<=、>= 时会出错,这时应该使用转义写法。

    方式一
    <     <=     >     >=     &     '     "
    &lt;     &lt;=     &gt;     &gt;=     &amp;     &apos;     &quot;

    示例:

    num &gt;= #{num}

    命名由来(gt、lt):

    方式二

    <![CDATA[  sql语句  ]]>

    示例:

    num <![CDATA[ >= ]]> #{num}

  • 相关阅读:
    今日小结 5.7
    今日小结 5.2
    今日小结 4.30
    今日小结 4.29
    设计模式 笔记1
    第一次找实习
    Java入门 任务表
    今日小结 4.24
    今日小结 4.18
    今日小结 4.17
  • 原文地址:https://www.cnblogs.com/xiaoshen666/p/10772244.html
Copyright © 2011-2022 走看看