mybatis foreach Map(String,List)类型
<select id="queryList" resultType="com.performancetest.modules.ptest.entity.StressTestSlaveEntity" > select * from test_stress_slave <where> <if test="slaveName != null and slaveName.trim() != ''"> slave_name like concat('%', #{slaveName}, '%') </if> <if test="status != null"> `status` = #{status} </if> <if test="slaveIds != null and slaveIds.isEmpty()==false"> slave_id in
-- collection为要迭代的变量,item为单个元素
<foreach item="slaveId" collection="slaveIds" open="(" separator="," close=")"> #{slaveId} </foreach> </if> </select>