MyBatis 批量修改记录

      <update id="update" parameterType="java.util.List">
          UPDATE setting 
          SET content = CASE id
              <foreach collection="list" item="setting" >
                  WHEN #{setting.id} THEN #{setting.content}
              </foreach>
          END
          WHERE 
              id in (<foreach collection="list" item="setting" separator="," >
                          #{setting.id}
                      </foreach>
                    )
      </update>

 

posted @ 2016-11-28 10:23  不知为何就叫呵呵  阅读(423)  评论(0编辑  收藏  举报