<?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.jianshui.invoice.mapper.RedinfoMapper">
    
    <resultMap type="Redinfo" id="RedinfoResult">
        <result property="id"    column="id"    />
        <result property="companyId"    column="company_id"    />
        <result property="systemOrderno"    column="system_orderno"    />
        <result property="outTradeOrderno"    column="out_trade_orderno"    />
        <result property="fpqqlsh"    column="fpqqlsh"    />
        <result property="billInfoId"    column="bill_info_id"    />
        <result property="redInfoNo"    column="red_info_no"    />
        <result property="redInfoStatus"    column="red_info_status"    />
        <result property="redInfoMessage"    column="red_info_message"    />
        <result property="redInfoType"    column="red_info_type"    />
        <result property="originFpdm"    column="origin_fpdm"    />
        <result property="redInfoSpecFlag"    column="red_info_spec_flag"    />
        <result property="originFphm"    column="origin_fphm"    />
        <result property="taxType"    column="tax_type"    />
        <result property="originKprq"    column="origin_kprq"    />
        <result property="multTaxRate"    column="mult_tax_rate"    />
        <result property="billInputTime"    column="bill_input_time"    />
        <result property="buyerName"    column="buyer_name"    />
        <result property="buyerTaxnum"    column="buyer_taxnum"    />
        <result property="sellerName"    column="seller_name"    />
        <result property="sellerTaxnum"    column="seller_taxnum"    />
        <result property="taxfreeamt"    column="taxfreeamt"    />
        <result property="tax"    column="tax"    />
        <result property="taxamt"    column="taxamt"    />
        <result property="applyRemark"    column="apply_remark"    />
        <result property="pdfUrl"    column="pdf_url"    />
        <result property="bmbbh"    column="bmbbh"    />
        <result property="businessTaxCode"    column="business_tax_code"    />
        <result property="applyTime"    column="apply_time"    />
        <result property="invoiceType"    column="invoice_type"    />
        <result property="fjh"    column="fjh"    />
        <result property="terminalNumber"    column="terminal_number"    />
        <result property="jspbh"    column="jspbh"    />
        <result property="ssyf"    column="ssyf"    />
        <result property="taxrate"    column="taxrate"    />
        <result property="sqxz"    column="sqxz"    />
        <result property="jbr"    column="jbr"    />
        <result property="reqnsrsbh"    column="reqnsrsbh"    />
        <result property="createBy"    column="create_by"    />
        <result property="productOilFlag"    column="product_oil_flag"    />
        <result property="callbackUrl"    column="callback_url"    />
        <result property="sqlb"    column="sqlb"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="serviceSupplierKey"    column="service_supplier_key"    />
    </resultMap>

    <resultMap id="RedinfoRedinfodetailResult" type="Redinfo" extends="RedinfoResult">
        <collection property="redinfodetailList" notNullColumn="sub_id" javaType="java.util.List" resultMap="RedinfodetailResult" />
    </resultMap>

    <resultMap type="Redinfodetail" id="RedinfodetailResult">
        <result property="id"    column="sub_id"    />
        <result property="redinfoId"    column="sub_redinfo_id"    />
        <result property="billno"    column="sub_billNo"    />
        <result property="index"    column="sub_index"    />
        <result property="goodName"    column="sub_good_name"    />
        <result property="unit"    column="sub_unit"    />
        <result property="spec"    column="sub_spec"    />
        <result property="num"    column="sub_num"    />
        <result property="price"    column="sub_price"    />
        <result property="taxfreeamt"    column="sub_taxfreeamt"    />
        <result property="taxrate"    column="sub_taxrate"    />
        <result property="tax"    column="sub_tax"    />
        <result property="taxamt"    column="sub_taxamt"    />
        <result property="spbm"    column="sub_spbm"    />
        <result property="bmbbh"    column="sub_bmbbh"    />
        <result property="yhzcbs"    column="sub_yhzcbs"    />
        <result property="zzstsgl"    column="sub_zzstsgl"    />
        <result property="lslbs"    column="sub_lslbs"    />
        <result property="goodAbbreviation"    column="sub_good_abbreviation"    />
        <result property="fphxz"    column="sub_fphxz"    />
        <result property="createBy"    column="sub_create_by"    />
        <result property="kce"    column="sub_kce"    />
        <result property="createTime"    column="sub_create_time"    />
        <result property="updateBy"    column="sub_update_by"    />
        <result property="updatedTime"    column="sub_updated_time"    />
    </resultMap>

    <sql id="selectRedinfoVo">
        select id, company_id, system_orderno, out_trade_orderno, fpqqlsh, bill_info_id, red_info_no, red_info_status, red_info_message, red_info_type, origin_fpdm, red_info_spec_flag, origin_fphm, tax_type, origin_kprq, mult_tax_rate, bill_input_time, buyer_name, buyer_taxnum, seller_name, seller_taxnum, taxfreeamt, tax, taxamt, apply_remark, pdf_url, bmbbh, business_tax_code, apply_time, invoice_type, fjh, terminal_number, jspbh, ssyf, taxrate, sqxz, jbr, reqnsrsbh, create_by, product_oil_flag, create_time, update_by, update_time ,service_supplier_key,callback_url,sqlb from redinfo
    </sql>

    <select id="selectRedinfoList" parameterType="Redinfo" resultMap="RedinfoResult">
        <include refid="selectRedinfoVo"/>
        <where>  
            <if test="companyId != null "> and company_id = #{companyId}</if>
            <if test="systemOrderno != null  and systemOrderno != ''"> and system_orderno = #{systemOrderno}</if>
            <if test="outTradeOrderno != null  and outTradeOrderno != ''"> and out_trade_orderno = #{outTradeOrderno}</if>
            <if test="fpqqlsh != null  and fpqqlsh != ''"> and fpqqlsh = #{fpqqlsh}</if>
            <if test="billInfoId != null "> and bill_info_id = #{billInfoId}</if>
            <if test="redInfoNo != null  and redInfoNo != ''"> and red_info_no = #{redInfoNo}</if>
            <if test="redInfoStatus != null  and redInfoStatus != ''"> and red_info_status = #{redInfoStatus}</if>
            <if test="redInfoMessage != null  and redInfoMessage != ''"> and red_info_message = #{redInfoMessage}</if>
            <if test="redInfoType != null  and redInfoType != ''"> and red_info_type = #{redInfoType}</if>
            <if test="originFpdm != null  and originFpdm != ''"> and origin_fpdm = #{originFpdm}</if>
            <if test="redInfoSpecFlag != null  and redInfoSpecFlag != ''"> and red_info_spec_flag = #{redInfoSpecFlag}</if>
            <if test="originFphm != null  and originFphm != ''"> and origin_fphm = #{originFphm}</if>
            <if test="taxType != null  and taxType != ''"> and tax_type = #{taxType}</if>
            <if test="originKprq != null  and originKprq != ''"> and origin_kprq = #{originKprq}</if>
            <if test="multTaxRate != null  and multTaxRate != ''"> and mult_tax_rate = #{multTaxRate}</if>
            <if test="billInputTime != null  and billInputTime != ''"> and bill_input_time = #{billInputTime}</if>
            <if test="buyerName != null  and buyerName != ''"> and buyer_name like concat('%', #{buyerName}, '%')</if>
            <if test="buyerTaxnum != null  and buyerTaxnum != ''"> and buyer_taxnum = #{buyerTaxnum}</if>
            <if test="sellerName != null  and sellerName != ''"> and seller_name like concat('%', #{sellerName}, '%')</if>
            <if test="sellerTaxnum != null  and sellerTaxnum != ''"> and seller_taxnum = #{sellerTaxnum}</if>
            <if test="taxfreeamt != null "> and taxfreeamt = #{taxfreeamt}</if>
            <if test="tax != null "> and tax = #{tax}</if>
            <if test="taxamt != null "> and taxamt = #{taxamt}</if>
            <if test="applyRemark != null  and applyRemark != ''"> and apply_remark = #{applyRemark}</if>
            <if test="pdfUrl != null  and pdfUrl != ''"> and pdf_url = #{pdfUrl}</if>
            <if test="bmbbh != null  and bmbbh != ''"> and bmbbh = #{bmbbh}</if>
            <if test="businessTaxCode != null  and businessTaxCode != ''"> and business_tax_code = #{businessTaxCode}</if>
            <if test="applyTime != null "> and apply_time = #{applyTime}</if>
            <if test="invoiceType != null  and invoiceType != ''"> and invoice_type = #{invoiceType}</if>
            <if test="fjh != null  and fjh != ''"> and fjh = #{fjh}</if>
            <if test="terminalNumber != null  and terminalNumber != ''"> and terminal_number = #{terminalNumber}</if>
            <if test="jspbh != null  and jspbh != ''"> and jspbh = #{jspbh}</if>
            <if test="ssyf != null  and ssyf != ''"> and ssyf = #{ssyf}</if>
            <if test="taxrate != null "> and taxrate = #{taxrate}</if>
            <if test="sqxz != null  and sqxz != ''"> and sqxz = #{sqxz}</if>
            <if test="jbr != null  and jbr != ''"> and jbr = #{jbr}</if>
            <if test="reqnsrsbh != null  and reqnsrsbh != ''"> and reqnsrsbh = #{reqnsrsbh}</if>
            <if test="productOilFlag != null  and productOilFlag != ''"> and product_oil_flag = #{productOilFlag}</if>
            <if test="serviceSupplierKey != null  and serviceSupplierKey != ''"> and service_supplier_key = #{serviceSupplierKey}</if>
            <if test="callbackUrl != null  and callbackUrl != ''"> and callback_url = #{callbackUrl}</if>
            <if test="sqlb != null  and sqlb != ''"> and sqlb = #{sqlb}</if>
        </where>
    </select>
    
    <select id="selectRedinfoById" parameterType="Long" resultMap="RedinfoRedinfodetailResult">
        select a.id, a.company_id, a.system_orderno, a.out_trade_orderno, a.fpqqlsh, a.bill_info_id, a.red_info_no, a.red_info_status, a.red_info_message, a.red_info_type, a.origin_fpdm, a.red_info_spec_flag, a.origin_fphm, a.tax_type, a.origin_kprq, a.mult_tax_rate, a.bill_input_time, a.buyer_name, a.buyer_taxnum, a.seller_name, a.seller_taxnum, a.taxfreeamt, a.tax, a.taxamt, a.apply_remark, a.pdf_url, a.bmbbh, a.business_tax_code, a.apply_time, a.invoice_type, a.fjh, a.terminal_number, a.jspbh, a.ssyf, a.taxrate, a.sqxz, a.jbr, a.reqnsrsbh, a.create_by, a.product_oil_flag, a.create_time, a.update_by, a.update_time,a.service_supplier_key,a.callback_url,a.sqlb,
 b.id as sub_id, b.redinfo_id as sub_redinfo_id, b.billNo as sub_billNo, b.index as sub_index, b.good_name as sub_good_name, b.unit as sub_unit, b.spec as sub_spec, b.num as sub_num, b.price as sub_price, b.taxfreeamt as sub_taxfreeamt, b.taxrate as sub_taxrate, b.tax as sub_tax, b.taxamt as sub_taxamt, b.spbm as sub_spbm, b.bmbbh as sub_bmbbh, b.yhzcbs as sub_yhzcbs, b.zzstsgl as sub_zzstsgl, b.lslbs as sub_lslbs, b.good_abbreviation as sub_good_abbreviation, b.fphxz as sub_fphxz, b.create_by as sub_create_by, b.kce as sub_kce, b.create_time as sub_create_time, b.update_by as sub_update_by, b.updated_time as sub_updated_time
        from redinfo a
        left join redinfodetail b on b.redinfo_id = a.id
        where a.id = #{id}
    </select>
    <select id="findRedInfoList" resultMap="RedinfoResult">
        select * from redinfo
        <where>
            <if test="redInfoNo != null  and redInfoNo != ''"> and red_info_no like concat('%', #{redInfoNo},'%')</if>
            <if test="buyerName != null  and buyerName != ''"> and buyer_name like concat('%', #{buyerName},'%')</if>
            <if test="buyerTaxnum != null  and buyerTaxnum != ''"> and buyer_taxnum like concat('%',#{buyerTaxnum},'%')</if>
            <if test="redInfoStatus != null  and redInfoStatus != ''"> and red_info_status like concat('%', #{redInfoStatus},'%')</if>
            <if test="originFpdm != null  and originFpdm != ''"> and origin_fpdm like concat('%', #{originFpdm},'%')</if>
            <if test="originFphm != null  and originFphm != ''"> and origin_fphm like concat('%', #{originFphm},'%')</if>
            <if test="beginBillInputTime != null  and beginBillInputTime != '' and endBillInputTime != null and endBillInputTime != ''"> and bill_input_time between #{beginBillInputTime} and #{endBillInputTime}</if>
        </where>
    </select>

    <insert id="insertRedinfo" parameterType="Redinfo" useGeneratedKeys="true" keyProperty="id">
        insert into redinfo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="companyId != null">company_id,</if>
            <if test="systemOrderno != null and systemOrderno != ''">system_orderno,</if>
            <if test="outTradeOrderno != null and outTradeOrderno != ''">out_trade_orderno,</if>
            <if test="fpqqlsh != null and fpqqlsh != ''">fpqqlsh,</if>
            <if test="billInfoId != null">bill_info_id,</if>
            <if test="redInfoNo != null">red_info_no,</if>
            <if test="redInfoStatus != null">red_info_status,</if>
            <if test="redInfoMessage != null">red_info_message,</if>
            <if test="redInfoType != null">red_info_type,</if>
            <if test="originFpdm != null">origin_fpdm,</if>
            <if test="redInfoSpecFlag != null and redInfoSpecFlag != ''">red_info_spec_flag,</if>
            <if test="originFphm != null">origin_fphm,</if>
            <if test="taxType != null">tax_type,</if>
            <if test="originKprq != null">origin_kprq,</if>
            <if test="multTaxRate != null">mult_tax_rate,</if>
            <if test="billInputTime != null">bill_input_time,</if>
            <if test="buyerName != null and buyerName != ''">buyer_name,</if>
            <if test="buyerTaxnum != null and buyerTaxnum != ''">buyer_taxnum,</if>
            <if test="sellerName != null and sellerName != ''">seller_name,</if>
            <if test="sellerTaxnum != null and sellerTaxnum != ''">seller_taxnum,</if>
            <if test="taxfreeamt != null">taxfreeamt,</if>
            <if test="tax != null">tax,</if>
            <if test="taxamt != null">taxamt,</if>
            <if test="applyRemark != null">apply_remark,</if>
            <if test="pdfUrl != null">pdf_url,</if>
            <if test="bmbbh != null">bmbbh,</if>
            <if test="businessTaxCode != null">business_tax_code,</if>
            <if test="applyTime != null">apply_time,</if>
            <if test="invoiceType != null and invoiceType != ''">invoice_type,</if>
            <if test="fjh != null">fjh,</if>
            <if test="terminalNumber != null">terminal_number,</if>
            <if test="jspbh != null">jspbh,</if>
            <if test="ssyf != null">ssyf,</if>
            <if test="taxrate != null">taxrate,</if>
            <if test="sqxz != null">sqxz,</if>
            <if test="jbr != null">jbr,</if>
            <if test="reqnsrsbh != null">reqnsrsbh,</if>
            <if test="createBy != null">create_by,</if>
            <if test="productOilFlag != null and productOilFlag != ''">product_oil_flag,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="serviceSupplierKey != null and serviceSupplierKey != ''">service_supplier_key,</if>
            <if test="callbackUrl != null and callbackUrl != ''">callback_url,</if>
            <if test="sqlb != null and sqlb != ''">sqlb,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="companyId != null">#{companyId},</if>
            <if test="systemOrderno != null and systemOrderno != ''">#{systemOrderno},</if>
            <if test="outTradeOrderno != null and outTradeOrderno != ''">#{outTradeOrderno},</if>
            <if test="fpqqlsh != null and fpqqlsh != ''">#{fpqqlsh},</if>
            <if test="billInfoId != null">#{billInfoId},</if>
            <if test="redInfoNo != null">#{redInfoNo},</if>
            <if test="redInfoStatus != null">#{redInfoStatus},</if>
            <if test="redInfoMessage != null">#{redInfoMessage},</if>
            <if test="redInfoType != null">#{redInfoType},</if>
            <if test="originFpdm != null">#{originFpdm},</if>
            <if test="redInfoSpecFlag != null and redInfoSpecFlag != ''">#{redInfoSpecFlag},</if>
            <if test="originFphm != null">#{originFphm},</if>
            <if test="taxType != null">#{taxType},</if>
            <if test="originKprq != null">#{originKprq},</if>
            <if test="multTaxRate != null">#{multTaxRate},</if>
            <if test="billInputTime != null">#{billInputTime},</if>
            <if test="buyerName != null and buyerName != ''">#{buyerName},</if>
            <if test="buyerTaxnum != null and buyerTaxnum != ''">#{buyerTaxnum},</if>
            <if test="sellerName != null and sellerName != ''">#{sellerName},</if>
            <if test="sellerTaxnum != null and sellerTaxnum != ''">#{sellerTaxnum},</if>
            <if test="taxfreeamt != null">#{taxfreeamt},</if>
            <if test="tax != null">#{tax},</if>
            <if test="taxamt != null">#{taxamt},</if>
            <if test="applyRemark != null">#{applyRemark},</if>
            <if test="pdfUrl != null">#{pdfUrl},</if>
            <if test="bmbbh != null">#{bmbbh},</if>
            <if test="businessTaxCode != null">#{businessTaxCode},</if>
            <if test="applyTime != null">#{applyTime},</if>
            <if test="invoiceType != null and invoiceType != ''">#{invoiceType},</if>
            <if test="fjh != null">#{fjh},</if>
            <if test="terminalNumber != null">#{terminalNumber},</if>
            <if test="jspbh != null">#{jspbh},</if>
            <if test="ssyf != null">#{ssyf},</if>
            <if test="taxrate != null">#{taxrate},</if>
            <if test="sqxz != null">#{sqxz},</if>
            <if test="jbr != null">#{jbr},</if>
            <if test="reqnsrsbh != null">#{reqnsrsbh},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="productOilFlag != null and productOilFlag != ''">#{productOilFlag},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="serviceSupplierKey != null and serviceSupplierKey != ''">#{serviceSupplierKey},</if>
            <if test="callbackUrl != null and callbackUrl != ''">#{callbackUrl},</if>
            <if test="sqlb != null and sqlb != ''">#{sqlb},</if>
        </trim>
    </insert>

    <update id="updateRedinfo" parameterType="Redinfo">
        update redinfo
        <trim prefix="SET" suffixOverrides=",">
            <if test="companyId != null">company_id = #{companyId},</if>
            <if test="systemOrderno != null and systemOrderno != ''">system_orderno = #{systemOrderno},</if>
            <if test="outTradeOrderno != null and outTradeOrderno != ''">out_trade_orderno = #{outTradeOrderno},</if>
            <if test="fpqqlsh != null and fpqqlsh != ''">fpqqlsh = #{fpqqlsh},</if>
            <if test="billInfoId != null">bill_info_id = #{billInfoId},</if>
            <if test="redInfoNo != null">red_info_no = #{redInfoNo},</if>
            <if test="redInfoStatus != null">red_info_status = #{redInfoStatus},</if>
            <if test="redInfoMessage != null">red_info_message = #{redInfoMessage},</if>
            <if test="redInfoType != null">red_info_type = #{redInfoType},</if>
            <if test="originFpdm != null">origin_fpdm = #{originFpdm},</if>
            <if test="redInfoSpecFlag != null and redInfoSpecFlag != ''">red_info_spec_flag = #{redInfoSpecFlag},</if>
            <if test="originFphm != null">origin_fphm = #{originFphm},</if>
            <if test="taxType != null">tax_type = #{taxType},</if>
            <if test="originKprq != null">origin_kprq = #{originKprq},</if>
            <if test="multTaxRate != null">mult_tax_rate = #{multTaxRate},</if>
            <if test="billInputTime != null">bill_input_time = #{billInputTime},</if>
            <if test="buyerName != null and buyerName != ''">buyer_name = #{buyerName},</if>
            <if test="buyerTaxnum != null and buyerTaxnum != ''">buyer_taxnum = #{buyerTaxnum},</if>
            <if test="sellerName != null and sellerName != ''">seller_name = #{sellerName},</if>
            <if test="sellerTaxnum != null and sellerTaxnum != ''">seller_taxnum = #{sellerTaxnum},</if>
            <if test="taxfreeamt != null">taxfreeamt = #{taxfreeamt},</if>
            <if test="tax != null">tax = #{tax},</if>
            <if test="taxamt != null">taxamt = #{taxamt},</if>
            <if test="applyRemark != null">apply_remark = #{applyRemark},</if>
            <if test="pdfUrl != null">pdf_url = #{pdfUrl},</if>
            <if test="bmbbh != null">bmbbh = #{bmbbh},</if>
            <if test="businessTaxCode != null">business_tax_code = #{businessTaxCode},</if>
            <if test="applyTime != null">apply_time = #{applyTime},</if>
            <if test="invoiceType != null and invoiceType != ''">invoice_type = #{invoiceType},</if>
            <if test="fjh != null">fjh = #{fjh},</if>
            <if test="terminalNumber != null">terminal_number = #{terminalNumber},</if>
            <if test="jspbh != null">jspbh = #{jspbh},</if>
            <if test="ssyf != null">ssyf = #{ssyf},</if>
            <if test="taxrate != null">taxrate = #{taxrate},</if>
            <if test="sqxz != null">sqxz = #{sqxz},</if>
            <if test="jbr != null">jbr = #{jbr},</if>
            <if test="reqnsrsbh != null">reqnsrsbh = #{reqnsrsbh},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="productOilFlag != null and productOilFlag != ''">product_oil_flag = #{productOilFlag},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="serviceSupplierKey != null and serviceSupplierKey != ''">service_supplier_key = #{serviceSupplierKey},</if>
            <if test="callbackUrl != null and callbackUrl != ''">callback_url = #{callbackUrl},</if>
            <if test="sqlb != null and sqlb != ''">sqlb = #{sqlb},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteRedinfoById" parameterType="Long">
        delete from redinfo where id = #{id}
    </delete>

    <delete id="deleteRedinfoByIds" parameterType="String">
        delete from redinfo where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
    <delete id="deleteRedinfodetailByRedinfoIds" parameterType="String">
        delete from redinfodetail where redinfo_id in 
        <foreach item="redinfoId" collection="array" open="(" separator="," close=")">
            #{redinfoId}
        </foreach>
    </delete>

    <delete id="deleteRedinfodetailByRedinfoId" parameterType="Long">
        delete from redinfodetail where redinfo_id = #{redinfoId}
    </delete>

    <insert id="batchRedinfodetail">
        INSERT INTO redinfodetail(`id`,
        `redinfo_id`,
        `billNo`,
        `index`,
        `good_name`,
        `unit`,
        `spec`,
        `num`,
        `price`,
        `taxfreeamt`,
        `taxrate`,
        `tax`,
        `taxamt`,
        `spbm`,
        `bmbbh`,
        `yhzcbs`,
        `zzstsgl`,
        `lslbs`,
        `good_abbreviation`,
        `fphxz`,
        `create_by`,
        `kce`,
        `create_time`,
        `update_by`,
        `updated_time`)  values
        <foreach item="item" index="index" collection="list" separator=",">
            ( #{item.id}, #{item.redinfoId}, #{item.billno}, #{item.index}, #{item.goodName}, #{item.unit}, #{item.spec}, #{item.num}, #{item.price}, #{item.taxfreeamt}, #{item.taxrate}, #{item.tax}, #{item.taxamt}, #{item.spbm}, #{item.bmbbh}, #{item.yhzcbs}, #{item.zzstsgl}, #{item.lslbs}, #{item.goodAbbreviation}, #{item.fphxz}, #{item.createBy}, #{item.kce}, #{item.createTime}, #{item.updateBy}, #{item.updatedTime})
        </foreach>
    </insert>

    <select id="getDetailId" resultType="java.lang.Long">
        select id from redinfodetail order by id desc limit 1
    </select>

    <select id="selectRedinfoDetailList" parameterType="java.lang.Long" resultType="com.jianshui.invoice.domain.Redinfodetail">
        select * from redinfodetail where redinfo_id = #{redInfoId}
    </select>
</mapper>