package com.jianshui.income.mapper;

import com.jianshui.income.domain.entity.InvoiceCheckDetail;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface InvoiceCheckDetailMapper {

    @Insert("<script> INSERT INTO invoice_check_detail "
            + "(id,invoice_check_id,mxbh,hwmc,je,spsl,sl,se,hsdj,hsje,bhsdj,ggxh,jldw,fyxm,cph,lx,txrqq,txrqz) "
            + "VALUES "
            + "<foreach collection='list' item='record' separator=',' > "
            + " (null,#{record.invoice_check_id},#{record.mxbh},#{record.hwmc},#{record.je},#{record.spsl},#{record.sl},#{record.se},#{record.hsdj},#{record.hsje},#{record.bhsdj},#{record.ggxh},#{record.jldw},#{record.fyxm},#{record.cph},#{record.lx},#{record.txrqq},#{record.txrqz}) "
            + "</foreach>"
            + "</script>")
    public int batchInsert(List<InvoiceCheckDetail> invoiceCheckDetailList);

    @Select("select * from invoice_check_detail where invoice_check_id = #{invoice_check_id}")
    public List<InvoiceCheckDetail> select(@Param("invoice_check_id") int invoice_check_id);

    @Delete("select * from invoice_check_detail where invoice_check_id = #{invoice_check_id}")
    public int delete(@Param("invoice_check_id") int invoice_check_id);

    @Delete("<script>" +
            "delete from invoice_check_detail where invoice_check_id in " +
            "<foreach item=\"item\" index=\"index\" collection=\"list\" open=\"(\" separator=\",\" close=\")\">" +
            "#{item}" +
            "</foreach>" +
            "</script>")
    public int batchDelete(List<Integer> invoice_check_id);

    @Select("select mxbh, hwmc, je, spsl, sl, se, hsdj,hsje,bhsdj,ggxh,jldw,fyxm,cph,lx,txrqq,txrqz from invoice_check_detail where invoice_check_id = #{invoice_check_id}")
    public List<InvoiceCheckDetail> selectdetail(@Param("invoice_check_id") Long invoice_check_id);


}
