zoukankan      html  css  js  c++  java
  • mybatis批量添加、批量删除

    <!-- 批量添加 -->
    <insert id="insertNameListSynHisBatch" parameterType="java.util.List" useGeneratedKeys="false">
    insert into tb_namelist_syn_his (SERIAL, RECORDNUMBER, HASHTBNAME,
    CTLTYPE, SOURCE, CREATETIME,
    CKEY, CVALUE)
    <foreach collection="list" item="his" index="index" separator=" union all ">
    (
    SELECT #{his.serial,jdbcType=VARCHAR},
    #{his.recordnumber,jdbcType=VARCHAR},
    #{his.hashtbname,jdbcType=VARCHAR},
    #{his.ctltype,jdbcType=VARCHAR},
    #{his.source,jdbcType=INTEGER},
    #{his.createtime,jdbcType=DATE},
    #{his.ckey,jdbcType=VARCHAR},
    #{his.cvalue,jdbcType=VARCHAR}
    FROM DUAL
    )
    </foreach>
    </insert>
    <!-- 批量删除 -->
    <delete id="deleteNameListSynHisBatch" parameterType="java.util.List">
    delete from tb_namelist_syn A
    where exists
    (
    select 1 from(
    <foreach collection="list" item="item" index="index" separator="union all">
    select B.* from tb_namelist_syn B where 1=1 and B.serial=#{item.serial,jdbcType=VARCHAR}
    </foreach>
    )S where A.serial=S.serial
    )
    </delete>

    如果不用@param系统默认list

  • 相关阅读:
    POJ
    POJ
    操作系统
    POJ
    POJ
    codeforces Educational Round 89
    codeforces Round 647(div. 2)
    codeforces Educational Round 88
    后缀自动机简单总结
    dsu on tree 简单总结
  • 原文地址:https://www.cnblogs.com/stormy/p/9218467.html
Copyright © 2011-2022 走看看