<update id="reorder" >
update tm01_department
<trim prefix="set" suffixOverrides=",">
<trim prefix="sort_no = case" suffix="end,">
<foreach collection="departments" item="item" index="index">
when dept_id = #{item.deptId} then #{item.sortNo}
</foreach>
</trim>
</trim>
where dept_id in
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</update>
int reorder(@Param("departments") List<Department> list,@Param("ids") int[] idArray);
1,传递多个参数时,用参数注解绑定多个参数名,在XML配置中使用注解的参数名。
2,foreach的collection可不局限于list,array等等
3,参数要根据collection的类型来决定怎么写