package com.bailuntec.balancesheet.mapper;

import com.bailuntec.balancesheet.dto.PlatformAndSiteDTO;
import org.apache.ibatis.annotations.Insert;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface DcPlatformAndSiteMapper {
    @Insert("<script>" +
            "insert into dc_platform_and_site(the_id,type,type_name,code,the_parent_id,english_name,china_name,status,status_name," +
            "platform_en_name,platform_cn_name,create_user_name,create_time,modify_user_name,modify_time,currency,currency_name) values" +
            "<foreach collection='list' item='item' index='index' separator=','>" +
            "(#{item.theId},#{item.type},#{item.typeName},#{item.code},#{item.theParentId},#{item.englishName},#{item.chinaName},#{item.status}," +
            "#{item.statusName},#{item.platformEnName},#{item.platformCnName},#{item.createUserName},#{item.createTime},#{item.modifyUserName}," +
            "#{item.modifyTime},#{item.currency},#{item.currencyName})" +
            "</foreach>" +
            "on duplicate key update type = values(type), type_name = values(type_name), code = values(code), the_parent_id = values(the_parent_id)," +
            "english_name = values(english_name), china_name = values(china_name), status = values(status), status_name = values(status_name)," +
            "platform_en_name = values(platform_en_name), platform_cn_name = values(platform_cn_name), create_user_name = values(create_user_name)," +
            "create_time = values(create_time), modify_user_name = values(modify_user_name), modify_time = values(modify_time), currency = values(currency)," +
            "currency_name = values(currency_name)" +
            "</script>")
    void insertPlatformAndSites(List<PlatformAndSiteDTO> platformAndSiteDTOList);



}
