1,批量插入配置
<insert >
    INSERT INTO t_novel (
        `name`
    ) values
    <foreach collection="list" item="item" index="index" separator="," >
    (
        #{item.name},
    )
    </foreach>
</insert>


2,批量更新配置
<update >
    <foreach collection="list" item="item" index="index" separator=";">
        UPDATE t_novel
        set
        updateTime=NOW()
        <if test="item.name != null">
            ,`name` = #{item.name}
        </if>
        WHERE id = #{item.id}
    </foreach>
</update>

  


3,重要,重要,重要
链接属性里面追加
allowMultiQueries=true
否则抛出com.mysql.jdbc.exceptions.MySQLSyntaxErrorException异常

 
                    
            
                

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2022-12-23
猜你喜欢
  • 2021-11-21
  • 2021-06-19
  • 2022-02-15
  • 2022-12-23
  • 2021-06-29
  • 2021-09-25
相关资源
相似解决方案