package com.jianshui.income.mapper;

import com.jianshui.income.domain.entity.InvoiceCheckFreight;
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 InvoiceCheckFreightMapper {


    @Insert({"replace into invoice_check_freight " +
            " (invoice_check_id,cyrmc,cyrsbh,spfmc,spfsbh,shrmc,shrsbh,fhrmc,fhrsbh,ysgwxx,qydjyddd,skph,czch,ccdw) " +
            " values (#{invoice_check_id},#{cyrmc},#{cyrsbh},#{spfmc},#{spfsbh},#{shrmc},#{shrsbh},#{fhrmc},#{fhrsbh},#{ysgwxx},#{qydjyddd},#{skph},#{czch},#{ccdw}) "
    })
    public int insertData(InvoiceCheckFreight invoiceCheckFreight);

    /**
     * 批量插入
     *
     * @param invoiceCheckFreights
     * @return
     */
    @Insert(
            "<script> replace into invoice_check_freight (invoice_check_id,cyrmc,cyrsbh,spfmc,spfsbh,shrmc,shrsbh,fhrmc,fhrsbh,ysgwxx,qydjyddd,skph,czch,ccdw) "
                    + " VALUES "
                    + "<foreach collection='list' item='record' separator=',' > "
                    + "(#{record.invoice_check_id},#{record.cyrmc},#{record.cyrsbh},#{record.spfmc},#{record.spfsbh},#{record.shrmc},#{record.shrsbh},#{record.fhrmc},#{record.fhrsbh},#{record.ysgwxx},#{record.qydjyddd},#{record.skph},#{record.czch},#{record.ccdw})"
                    + "</foreach>"
                    + "</script>"
    )
    public int replaceBatch(List<InvoiceCheckFreight> invoiceCheckFreights);

    /**
     * 查询信息
     */
    @Select("select * from invoice_check_freight where invoice_check_id = #{invoice_check_id} limit 1")
    public InvoiceCheckFreight selectOne(@Param("invoice_check_id") int invoice_check_id);
    /**
     * 查询
     */
    @Select("select * from invoice_check_freight where invoice_check_id = #{invoice_check_id} limit 1")
    public InvoiceCheckFreight selectone(@Param("invoice_check_id") Long invoice_check_id);

    public InvoiceCheckFreight selectInvoiceCheckFreightById(Long invoice_check_id);
}
