MyBatis的SQL语句映射文件详解----多参数传递的几种方式

wylc123 1年前 ⋅ 768 阅读

MyBatis的SQL语句映射文件详解(三)----多参数传递的几种方式

Mapping.java

int deleteByIds(@Param("ids")List<Integer> ids,@Param("tablename")String tablename);

mapping.xml

<update id="deleteByIds" parameterType="map">
    UPDATE ${tablename} SET STATE = 0 WHERE ID in
    <foreach collection="ids" item="id" open="(" separator="," close=")">
      #{id}
    </foreach>
  </update>
更多内容请访问:IT源点

相关文章推荐

全部评论: 0

    我有话说: