MyBatis 批次修改記錄

不知為何就叫呵呵發表於2016-11-28
      <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>

 

相關文章