<-- SQL IN 多值查询 --> <if test="param.col13 != null and param.col13.size() >0" > AND COL13 IN <foreach collection="param.col13" item="item" open="(" close=")" separator="," > #{item,jdbcType=VARCHAR} </foreach> </if> <-- SQL LIKE 多值查询 --> <if test="param.checkList != null and param.checkList.size() >0" > AND <foreach collection="param.checkList" item="item" open="(" close=")" separator="OR" > CHECKLIST LIKE CONCAT(CONCAT('%',#{item,jdbcType=VARCHAR}),'%') </foreach> </if>
jdbcType=VARCHAR - 集合元素的类型(orcal 不写数字类型匹配不了,Mysql 自动忽略)