package com.bailuntec.balancesheet.mapper;

import com.bailuntec.balancesheet.dto.BuyDTO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface DcBaseBuyMapper {

    @Insert("<script>" +
            "insert into dc_base_buy(no,buyno,buystatus,paycompanyname,skucode,skuname,arrivaldate,warehouseid,warehousename,paycompanyid,supplierid,suppliername," +
            "paytype,amount,payamount,count,expressfee,createtime,lastupdateuserid,lastupdateusername,lastupdatetime,buyuserid,paystatus,sendstatus,createuserid," +
            "createusername,orderno,note,delstatus,isurgency,buyusername,fileid,filepath,departmentid,departmentname,audituserid,auditusername,audittime,auditnote,company," +
            "supplier_no,reject_reason,detail_key,link_lend_cost_no,supplier_bankname,supplier_cardno,supplier_cardusername,pay_time,sku_type_name,company_value,day) values " +
            "<foreach collection='list' item='item' index='index' separator=','>" +
            "(#{item.no},#{item.buyno},#{item.buystatus},#{item.paycompanyname},#{item.skucode},#{item.skuname},#{item.arrivaldate},#{item.warehouseid},#{item.warehousename}," +
            "#{item.paycompanyid},#{item.supplierid},#{item.suppliername},#{item.paytype},#{item.amount},#{item.payamount},#{item.count},#{item.expressfee},#{item.createtime}," +
            "#{item.lastupdateuserid},#{item.lastupdateusername},#{item.lastupdatetime},#{item.buyuserid},#{item.paystatus},#{item.sendstatus},#{item.createuserid}," +
            "#{item.createusername},#{item.orderno},#{item.note},#{item.delstatus},#{item.isurgency},#{item.buyusername},#{item.fileid},#{item.filepath},#{item.departmentid}," +
            "#{item.departmentname},#{item.audituserid},#{item.auditusername},#{item.audittime},#{item.auditnote},#{item.company},#{item.supplierNo},#{item.rejectReason}," +
            "#{item.detailKey},#{item.linkLendCostNo},#{item.supplierBankname},#{item.supplierCardno},#{item.supplierCardusername},#{item.payTime}," +
            "#{item.skuTypeName},#{item.companyValue},#{lastDay})" +
            "</foreach>" +
            "</script>")
    void insertDcBaseBuy(@Param("list") List<BuyDTO> buyDTOList, @Param("lastDay") Date lastDay);

}

