<select id="findDataByCodes" resultMap="BaseResultMap" > select <include refid="this_list" /> from EDIIS_BLACK_LIST_UNIT t where 1=1 <if test="array !=null and array.length > 0"> and t.code in <foreach collection="array" item = "code" open="(" separator="," close=")" index="index"> #{code} </foreach> </if> </select>
切记,上面一个小问题搞了我几个小时,当用数组作为参数时候,参数名必须为“array”