mybatis执行批量更新batch update 的方法
来源:互联网 发布:python入门教程第三版 编辑:程序博客网 时间:2024/05/22 09:05
1、数据库连接必须配置:&allowMultiQueries=true
我的配置如下:jdbc:mysql://10.20.13.16:3306/CALENDAR?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
2、批量修改并加判断条件(修改字段可选)
<!-- 批量更新赛程 --> <update id="updateMatchs" parameterType="java.util.List"> <foreach collection="matchs" item="item" index="index" open="" close="" separator=";"> update t_match <set> <if test="item.title !=null"> TITLE = #{item.title,jdbcType=VARCHAR}, </if> <if test="item.homeScore !=null"> HOME_SCORE = #{item.homeScore,jdbcType=INTEGER}, </if> <if test="item.visitScore !=null"> VISTT_SCORE = #{item.visitScore,jdbcType=INTEGER}, </if> <if test="item.liveSource !=null"> LIVE_SOURCE = #{item.liveSource,jdbcType=VARCHAR}, </if> <if test="item.liveURL !=null"> LIVE_URL = #{item.liveURL,jdbcType=VARCHAR}, </if> <if test="item.isHotMatch !=null"> IS_HOT_MATCH = #{item.isHotMatch,jdbcType=VARCHAR} </if> </set> where HOME_TEAM_ID = #{item.homeTeamId,jdbcType=VARCHAR} and VISIT_TEAM_ID = #{item.visitTeamId,jdbcType=VARCHAR} and MATCH_TIME = #{item.matchTime,jdbcType=BIGINT} </foreach> </update>
java接口
/** * 批量修改赛程 * * @param matchs * @throws DaoException */ void updateMatchs(@Param(value = "matchs")List<MatchBasic> matchs);
阅读全文
0 0
- mybatis执行批量更新batch update 的方法
- mybatis执行批量更新batch update 的方法
- mybatis执行批量更新batch update 的方法
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis 执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(提供oracle,mysql两种写法)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- mybatis执行批量更新batch update 的方法(oracle,mysql)
- Python 用pyinstaller生成可执行文件No module named 'pefile'
- WKWebView之OC代码注入,删除百度HTML页面的按钮
- Android 最常用的设计模式九 安卓源码分析—— 适配器模式(Adapter)
- Java虚拟机(JVM)中的内存设置详解
- Linux vi 撤销与取消撤销
- mybatis执行批量更新batch update 的方法
- 剑指offer第六题
- 指针与引用的区别
- 快速制作演示动画的工具TurboDemo常见问题合集(二)
- Python学习第一周-知识点
- hdu 1296 迷宫城堡【有向图scc+Tarjan入门】
- 变态跳台阶
- Closure&Inherit
- Java 定时器 Timer 的使用