<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.backendsys.modules.cms.navigation.dao.NavigationI18nDao">

    <!-- 批量插入 -->
    <insert id="insertBatch" parameterType="java.util.List">
        INSERT INTO cms_navigation_i18n (
            navigation_id, language,
            navigation_name, link
        )
        VALUES
        <foreach collection="translations" item="item" separator=",">
        (
            #{item.navigation_id}, #{item.language},
            #{item.navigation_name}, #{item.link}
        )
        </foreach>
    </insert>

    <!-- 批量更新 -->
    <update id="updateBatch" parameterType="com.backendsys.modules.cms.navigation.entity.NavigationI18n">
        <foreach collection="translations" item="item" separator=";">
            UPDATE cms_navigation_i18n
            <set>
                <trim suffixOverrides="," suffix=" ">
                    navigation_name = #{item.navigation_name},
                    link = #{item.link}
                </trim>
            </set>
            WHERE navigation_id = #{item.navigation_id} AND language = #{item.language}
        </foreach>
    </update>

</mapper>
