<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeeplus.finance.invoice.mapper.CwFinanceInvoiceBaseMapper">

    <resultMap id="BaseResultMap" type="com.jeeplus.finance.invoice.service.dto.CwFinanceInvoiceBaseDTO">
            <id property="id" column="id" jdbcType="VARCHAR"/>
            <result property="createBy.id" column="create_by" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
            <result property="updateBy.id" column="update_by" jdbcType="VARCHAR"/>
            <result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
            <result property="delFlag" column="del_flag" jdbcType="INTEGER"/>
            <result property="invoiceId" column="invoice_id" jdbcType="VARCHAR"/>
            <result property="programId" column="program_id" jdbcType="VARCHAR"/>
            <result property="programName" column="program_name" jdbcType="VARCHAR"/>
            <result property="contractName" column="contract_name" jdbcType="VARCHAR"/>
            <result property="programNo" column="program_no" jdbcType="VARCHAR"/>
            <result property="contractId" column="contract_id" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        fib.id,
        fib.create_by,
        fib.create_date,
        fib.update_by,
        fib.update_date,
        fib.del_flag,
        fib.invoice_id,
        fib.program_id,
        fib.program_name,
        fib.contract_name,
        fib.program_no,
        fib.contract_id
    </sql>

    <insert id="insertBatch">
        insert into cw_finance_invoice_base(
            id,
            create_by_id,
            create_time,
            update_by_id,
            update_time,
            del_flag,
            invoice_id,
            program_id,
            program_name,
            program_no,
            contract_id,
            contract_name,
            account,
            `type`,
            tenant_id
        )values
        <foreach collection="baseList" item="item" separator=",">
            (#{item.id},
            #{item.createById},
            #{item.createTime},
            #{item.updateById},
            #{item.updateTime},
            #{item.delFlag},
            #{item.invoiceId},
            #{item.programId},
            #{item.programName},
            #{item.programNo},
            #{item.contractId},
            #{item.contractName},
            #{item.account},
            #{item.type},
            #{item.tenantId})
        </foreach>
    </insert>
</mapper>
