mybatis批量插入

<insert id="insertBatch" parameterType="java.util.List" >
        insert into biz_indexes_day (company_code, type,
        record_date, idx501, idx502,
        idx503, idx504, idx505,
        idx506, idx507, idx508,
        idx509, idx510, idx511,
        idx512, idx513, idx514,
        idx515, idx516, idx517,
        idx518, idx519, idx520,
        idx521, idx522, idx523,
        idx524, idx525, idx526,
        idx527, idx528, idx529,
        idx530, gtm_create, gtm_modify
        )
        values  <foreach collection="array" item="obj" index="index" separator=",">
        (#{obj.companyCode,jdbcType=VARCHAR}, #{obj.type,jdbcType=CHAR},
        #{obj.recordDate,jdbcType=CHAR}, #{obj.idx501,jdbcType=DOUBLE}, #{obj.idx502,jdbcType=DOUBLE},
        #{obj.idx503,jdbcType=DOUBLE}, #{obj.idx504,jdbcType=DOUBLE}, #{obj.idx505,jdbcType=DOUBLE},
        #{obj.idx506,jdbcType=DOUBLE}, #{obj.idx507,jdbcType=DOUBLE}, #{obj.idx508,jdbcType=DOUBLE},
        #{obj.idx509,jdbcType=DOUBLE}, #{obj.idx510,jdbcType=DOUBLE}, #{obj.idx511,jdbcType=DOUBLE},
        #{obj.idx512,jdbcType=DOUBLE}, #{obj.idx513,jdbcType=DOUBLE}, #{obj.idx514,jdbcType=DOUBLE},
        #{obj.idx515,jdbcType=DOUBLE}, #{obj.idx516,jdbcType=DOUBLE}, #{obj.idx517,jdbcType=DOUBLE},
        #{obj.idx518,jdbcType=DOUBLE}, #{obj.idx519,jdbcType=DOUBLE}, #{obj.idx520,jdbcType=DOUBLE},
        #{obj.idx521,jdbcType=DOUBLE}, #{obj.idx522,jdbcType=DOUBLE}, #{obj.idx523,jdbcType=DOUBLE},
        #{obj.idx524,jdbcType=DOUBLE}, #{obj.idx525,jdbcType=DOUBLE}, #{obj.idx526,jdbcType=DOUBLE},
        #{obj.idx527,jdbcType=DOUBLE}, #{obj.idx528,jdbcType=DOUBLE}, #{obj.idx529,jdbcType=DOUBLE},
        #{obj.idx530,jdbcType=DOUBLE}, #{obj.gtmCreate,jdbcType=TIMESTAMP}, #{obj.gtmModify,jdbcType=TIMESTAMP}
        )
    </foreach>
    </insert>

mapper:

void insertBatch(BizIndexesDay[] bizIndexes);

 

posted @ 2017-06-08 14:43  三国梦回  阅读(417)  评论(0编辑  收藏  举报