1. 程式人生 > >Mybatis mapper配置檔案傳入陣列引數,同時操作一組資料

Mybatis mapper配置檔案傳入陣列引數,同時操作一組資料

mapper.xml

<select id="findMemberByIds" resultType="map">
		select 
			id,
			token,
			username,
			pic
		from
		    lm_member
		    <where>
                id in
                <foreach collection="array" item="id" index="index"
                         open="(" close=")" separator=",">
                    #{id}
                </foreach>
		    </where>
	</select>
mapper.java
public List<Map<String, Object>> findMemberByIds(Long[] ids);