在mapper.xml中遍历添加多条数据

<insert id="saveAuditDf" parameterType="java.util.List">
    insert into audit_df (jhr, jhtgds, jhbtgds, jhrq, id, time)
    values
    <foreach collection="list" item="item"  separator="," index="">
      <foreach collection="item" item="str" open="(" close=")" separator="," index="">
        #{str}
      </foreach>
  </foreach>
  </insert>

saveAuditDf为接口名称,
java.util.List为输入参数的类型,

  

posted on 2020-08-24 17:05  海哥哥99  阅读(1219)  评论(0编辑  收藏  举报

导航