MyBatis Like

MySQL:

<select id="listByPidsLikeName" resultType="com.xdt.ibs.environ.device.bean.Environ">
        SELECT id,pid,logicid,`name`,`type`,ip_addr AS ipAddr,`port`,modbus_addr AS modbusAddr,pm25_h AS pm25H,
      pm10_h AS pm10H,temp_h AS tempH,humi_h AS humiH,co2_h AS co2H,tvoc_h AS tvocH,conn_status AS connStatus,
      update_time AS updateTime,create_time AS createTime FROM environ WHERE pid IN
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> <if test="name != null and name != ''"> AND `name` like CONCAT('%',#{name},'%') </if> </select>

啦啦啦

posted @ 2017-01-13 12:34  limeOracle  阅读(219)  评论(0编辑  收藏  举报