MyBatis中in 的使用方法
2018-11-28 本文已影响0人
小安的大情调
在MyBatis
中使用in
关键字参数为集合时,需要使用到foreach
标签。
下面详细介绍以下foreach标签的几个参数

实例:
<select id="getNewListByLabelID" resultMap="BaseResultMap" parameterType="arraylist">
SELECT
<include refid="Base_Column_List"/>
FROM tb_problem
WHERE id IN
<foreach collection="ids" index="index" item="id" separator="," close=")" open="(">
#{id}
</foreach>
</select>