package com.jianshui.income.mapper;

import com.jianshui.income.domain.entity.InvoiceCheckToll;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface InvoiceCheckTollMapper {


    @Insert({"replace into invoice_check_toll " +
            " (invoice_check_id,txfbz,lslbs) " +
            " values (#{invoice_check_id},#{txfbz},#{lslbs}) "
    })
    public int insertData(InvoiceCheckToll invoiceCheckToll);

    /**
     * 批量插入
     *
     * @param invoiceCheckTolls
     * @return
     */
    @Insert(
            "<script> replace into invoice_check_toll (invoice_check_id,txfbz,lslbs) "
                    + " VALUES "
                    + "<foreach collection='list' item='record' separator=',' > "
                    + "(#{record.invoice_check_id},#{record.txfbz},#{record.lslbs})"
                    + "</foreach>"
                    + "</script>"
    )
    public int replaceBatch(List<InvoiceCheckToll> invoiceCheckTolls);

    @Select("select * from invoice_check_toll where invoice_check_id = #{invoice_check_id} limit 1")
    public InvoiceCheckToll selectOne(@Param("invoice_check_id") int invoice_check_id);

    public InvoiceCheckToll selectInvoiceCheckTollById(Long invoice_check_id);
}
