<?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.vetti.system.mapper.SysInternationalInfoMapper">
    
    <resultMap type="SysInternationalInfo" id="SysInternationalInfoResult">
        <result property="id"    column="id"    />
        <result property="resourceId"    column="resource_id"    />
        <result property="resourceType"    column="resource_type"    />
        <result property="resourceZhText"    column="resource_zh_text"    />
        <result property="resourceEnText"    column="resource_en_text"    />
        <result property="resourceJaText"    column="resource_ja_text"    />
        <result property="remark"    column="remark"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="versionNo"    column="version_no"    />
    </resultMap>

    <sql id="selectSysInternationalInfoVo">
        select id, resource_id, resource_type, resource_zh_text, resource_en_text, resource_ja_text, remark, del_flag, create_by, create_time, update_by, update_time, version_no from sys_international_info
    </sql>

    <select id="selectSysInternationalInfoList" parameterType="SysInternationalInfo" resultMap="SysInternationalInfoResult">
        <include refid="selectSysInternationalInfoVo"/>
        <where>  
            <if test="resourceId != null  and resourceId != ''"> and resource_id = #{resourceId}</if>
            <if test="resourceType != null  and resourceType != ''"> and resource_type = #{resourceType}</if>
            <if test="resourceZhText != null  and resourceZhText != ''"> and resource_zh_text = #{resourceZhText}</if>
            <if test="resourceEnText != null  and resourceEnText != ''"> and resource_en_text = #{resourceEnText}</if>
            <if test="resourceJaText != null  and resourceJaText != ''"> and resource_ja_text = #{resourceJaText}</if>
            <if test="versionNo != null "> and version_no = #{versionNo}</if>
        </where>
    </select>
    
    <select id="selectSysInternationalInfoById" parameterType="Long" resultMap="SysInternationalInfoResult">
        <include refid="selectSysInternationalInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSysInternationalInfo" parameterType="SysInternationalInfo" useGeneratedKeys="true" keyProperty="id">
        insert into sys_international_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="resourceId != null">resource_id,</if>
            <if test="resourceType != null">resource_type,</if>
            <if test="resourceZhText != null">resource_zh_text,</if>
            <if test="resourceEnText != null">resource_en_text,</if>
            <if test="resourceJaText != null">resource_ja_text,</if>
            <if test="remark != null">remark,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="versionNo != null">version_no,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="resourceId != null">#{resourceId},</if>
            <if test="resourceType != null">#{resourceType},</if>
            <if test="resourceZhText != null">#{resourceZhText},</if>
            <if test="resourceEnText != null">#{resourceEnText},</if>
            <if test="resourceJaText != null">#{resourceJaText},</if>
            <if test="remark != null">#{remark},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="versionNo != null">#{versionNo},</if>
         </trim>
    </insert>

    <update id="updateSysInternationalInfo" parameterType="SysInternationalInfo">
        update sys_international_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="resourceId != null">resource_id = #{resourceId},</if>
            <if test="resourceType != null">resource_type = #{resourceType},</if>
            <if test="resourceZhText != null">resource_zh_text = #{resourceZhText},</if>
            <if test="resourceEnText != null">resource_en_text = #{resourceEnText},</if>
            <if test="resourceJaText != null">resource_ja_text = #{resourceJaText},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="versionNo != null">version_no = #{versionNo},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysInternationalInfoById" parameterType="Long">
        delete from sys_international_info where id = #{id}
    </delete>

    <delete id="deleteSysInternationalInfoByIds" parameterType="String">
        delete from sys_international_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <insert id="batchInsertSysInternationalInfo">
        insert into sys_international_info( id, resource_id, resource_type, resource_zh_text, resource_en_text, resource_ja_text, remark, del_flag, create_by, create_time, update_by, update_time, version_no) values
        <foreach item="item" index="index" collection="list" separator=",">
            ( #{item.id}, #{item.resourceId}, #{item.resourceType}, #{item.resourceZhText}, #{item.resourceEnText}, #{item.resourceJaText}, #{item.remark}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.versionNo})
        </foreach>
    </insert>
</mapper>