1. 程式人生 > >mybatis 關於集合查詢

mybatis 關於集合查詢

1.ArrayList查詢

select * from t_hjjk3
      <where>
          1=1
          <if test="devAddrList != null and devAddrList.size() > 0">
            AND t_hjjk3.`DevAddr` IN
            <foreach  collection="devAddrList" item="devAddr" open="("  separator=","  close=")">
              #{devAddr}
            </foreach>
          </if>
      </where>