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>

 

相关文章:

  • 2022-12-23
  • 2022-01-11
  • 2021-08-06
  • 2021-07-24
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
相关资源
相似解决方案