<?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.ruoyi.basic.mapper.HwDictDataLanguageMapper">
    
    <resultMap type="HwDictDataLanguage" id="HwDictDataLanguageResult">
        <result property="dataLanguageId"    column="data_language_id"    />
        <result property="dictCode"    column="dict_code"    />
        <result property="dictLabel"    column="dict_label"    />
        <result property="languageCode"    column="language_code"    />
    </resultMap>

    <sql id="selectHwDictDataLanguageVo">
        select data_language_id, dict_code, dict_label, language_code from hw_dict_data_language
    </sql>

    <select id="selectHwDictDataLanguageList" parameterType="HwDictDataLanguage" resultMap="HwDictDataLanguageResult">
        <include refid="selectHwDictDataLanguageVo"/>
        <where>  
            <if test="dictCode != null "> and dict_code = #{dictCode}</if>
            <if test="dictLabel != null  and dictLabel != ''"> and dict_label = #{dictLabel}</if>
            <if test="languageCode != null  and languageCode != ''"> and language_code = #{languageCode}</if>
        </where>
    </select>
    
    <select id="selectHwDictDataLanguageByDataLanguageId" parameterType="Long" resultMap="HwDictDataLanguageResult">
        <include refid="selectHwDictDataLanguageVo"/>
        where data_language_id = #{dataLanguageId}
    </select>
        
    <insert id="insertHwDictDataLanguage" parameterType="HwDictDataLanguage" useGeneratedKeys="true" keyProperty="dataLanguageId">
        insert into hw_dict_data_language
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dictCode != null">dict_code,</if>
            <if test="dictLabel != null">dict_label,</if>
            <if test="languageCode != null and languageCode != ''">language_code,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dictCode != null">#{dictCode},</if>
            <if test="dictLabel != null">#{dictLabel},</if>
            <if test="languageCode != null and languageCode != ''">#{languageCode},</if>
         </trim>
    </insert>

    <update id="updateHwDictDataLanguage" parameterType="HwDictDataLanguage">
        update hw_dict_data_language
        <trim prefix="SET" suffixOverrides=",">
            <if test="dictCode != null">dict_code = #{dictCode},</if>
            <if test="dictLabel != null">dict_label = #{dictLabel},</if>
            <if test="languageCode != null and languageCode != ''">language_code = #{languageCode},</if>
        </trim>
        where data_language_id = #{dataLanguageId}
    </update>

    <delete id="deleteHwDictDataLanguageByDataLanguageId" parameterType="Long">
        delete from hw_dict_data_language where data_language_id = #{dataLanguageId}
    </delete>

    <delete id="deleteHwDictDataLanguageByDataLanguageIds" parameterType="String">
        delete from hw_dict_data_language where data_language_id in 
        <foreach item="dataLanguageId" collection="array" open="(" separator="," close=")">
            #{dataLanguageId}
        </foreach>
    </delete>
</mapper>