<?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.ho.flow.mapper.TranslateNameMapper">

    <sql id="Base_Column_List">
        id,`name`,name_en,name_fra,name_spa,name_de,name_pl,name_ara
    </sql>

    <select id="getDictNation" resultType="com.ho.business.entity.TranslateName">
        select <include refid="Base_Column_List"/> from translate_name
    </select>

    <select id="selectNameLang" resultType="com.ho.business.entity.TranslateName">
        select <include refid="Base_Column_List"/> from translate_name where name = #{name} limit 1
    </select>

    <update id="updateById">
        update translate_name
        set name_en=#{vo.nameEn},name_fra=#{vo.nameFra},
            name_spa = #{vo.nameSpa},name_de=#{vo.nameDe},
            name_pl = #{vo.namePl},name_ara = #{vo.nameAra}
        where id = #{vo.id}
    </update>

    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.TranslateName"
            useGeneratedKeys="true">
        insert into translate_name
            ( id, name, name_en,name_fra,name_spa,name_de,name_pl,name_ara)
        values ( #{vo.id,jdbcType=INTEGER}, #{vo.name,jdbcType=VARCHAR}, #{vo.nameEn,jdbcType=VARCHAR},
                 #{vo.nameFra,jdbcType=VARCHAR},#{vo.nameSpa,jdbcType=VARCHAR},#{vo.nameDe,jdbcType=VARCHAR},
                 #{vo.namePl,jdbcType=VARCHAR},#{vo.nameAra,jdbcType=VARCHAR})
    </insert>

</mapper>
