mybatis

Posted 手中天

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis相关的知识,希望对你有一定的参考价值。

1.id in ids (数组)

SELECT
   *
  FROM
   `cw_alarm_info`
  <where>
   <if test="beginTime != null and beginTime!= ‘‘ and endTime != null and endTime != ‘‘">
    createTime BETWEEN #{beginTime} AND #{endTime}
   </if>
   <if test="minSim != null and minSim != ‘‘ and maxSim != null and maxSim != ‘‘">
    AND similiar BETWEEN #{minSim} AND #{maxSim}
   </if>
   <if test="cameraId != null and cameraId != ‘‘">
    AND cameraId = #{cameraId}
   </if>
   <if test="libraryIds != null and libraryIds.size > 0 ">
    AND libraryId in
    <foreach collection="libraryIds" index="index" item="item" open="(" separator="," close=")">
                #{item}
             </foreach>
            </if>
   <if test="controllerNO != null and controllerNO != ‘‘">
    AND controllerNO = #{controllerNO}
   </if>
  </where>
























以上是关于mybatis的主要内容,如果未能解决你的问题,请参考以下文章

Java 布尔运算

java [Java] Java常用代码#java

Java - 35 Java 实例

Java While 循环

Java 字符串

Java If ... Else