ibatis中批量插入(mySql)

ibatis中insert一个list,不用写for循环一条一条插入。invoiceList就是传入的list,例如:

<insert id="insertInvoice" parameterClass="commissionOutCashOrder">< xmlnamespace prefix ="o" ns ="urn:schemas-microsoft-com:office:office" />

       passport.invoice (

           outcash_no,

           invoice_headd,

           invoice_no,

           invoice_balance,

           create_time,

           remark

        )VALUES

        <iterate property="invoiceList" conjunction="," >

        (

           #outCashNo#,

           #invoiceList[].invoiceHead#,

           #invoiceList[].invoiceNo#,

           #invoiceList[].invoiceBalance#,

           #invoiceList[].createTime#,

           #invoiceList[].remark#

        )

         iterate>

    insert>

转载于:https://www.cnblogs.com/xiaocay/archive/2013/03/08/2950115.html

你可能感兴趣的:(ibatis中批量插入(mySql))