当前位置: 移动技术网 > IT编程>数据库>MSSQL > MyBatis批量修改操作

MyBatis批量修改操作

2018年11月24日  | 移动技术网IT编程  | 我要评论

1.需求

  后台管理页面,查询频道列表,需要批量修改频道的状态,批量上线和下线

2.mybatis配置

这是mysql的配置,注意需要加上&allowmultiqueries=true配置

jdbc_url=jdbc:mysql://localhost:3306/go?useunicode=true&characterencoding=utf-8&zerodatetimebehavior=converttonull&allowmultiqueries=true

<update id="batchupdate"  parametertype="java.util.list">
         <foreach collection="list" item="item" index="index" open="" close="" separator=";">
               update channels
               <set>
                 state=${item.state}
               </set>
               where id = ${item.id}
        </foreach>
 </update>

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网