<?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.iamberry.wechat.service.mapper.CustomizedExternalUrlMapper">
    <resultMap  id="BaseResultMap" type="CustomizedExternalUrl" >
        <result    column="external_url_id"    property="externalUrlId" />
        <result    column="external_id"    property="externalId" />
        <result    column="external_img"    property="externalImg" />
        <result    column="external_create_time"    property="externalCreateTime" />
    </resultMap>
    <sql    id="Base_List" >
        t.external_url_id,
        t.external_id,
        t.external_img,
        t.external_create_time
    </sql>
    <select id="getCustomizedExternalUrlList" resultMap="BaseResultMap" parameterType="CustomizedExternalUrl" >
        select
        <include refid="Base_List" />
        from tb_iamberry_customized_external_url t
        <where>
            <if test="externalUrlId != null ">
                AND t.external_url_id = #{externalUrlId}
            </if >
        </where>
    </select>
    <select id="getCustomizedExternalUrlById" resultMap="BaseResultMap" parameterType="Integer" >
        select
        <include refid="Base_List" />
        from tb_iamberry_customized_external_url t
        where t.external_url_id= #{externalUrlId}
    </select>
    <insert id="save" parameterType="CustomizedExternalUrl" >
        insert into
        tb_iamberry_customized_external_url
        (
        external_id,
        external_img
        )
        values
        (
        #{externalId},
        #{externalImg}
        )
    </insert>
    <update id="update" parameterType="CustomizedExternalUrl" >
        update
        tb_iamberry_customized_external_url
        <set >
            <if test="externalId != null and externalId != ''">
                external_id = #{externalId},
            </if >
            <if test="externalImg != null and externalImg != ''">
                external_img = #{externalImg},
            </if >
        </set >
        where external_url_id= #{externalUrlId}
    </update>
</mapper>