BrandMapper.xml 5.04 KB
<?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.yoho.search.dal.BrandMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.Brand">
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="brand_name" property="brandName" jdbcType="VARCHAR" />
        <result column="brand_domain" property="brandDomain" jdbcType="VARCHAR" />
        <result column="brand_alif" property="brandAlif" jdbcType="VARCHAR" />
        <result column="brand_ico" property="brandIco" jdbcType="VARCHAR" />
        <result column="is_hot" property="isHot" jdbcType="CHAR" />
        <result column="brand_name_cn" jdbcType="VARCHAR" property="brandNameCn" />
        <result column="brand_name_en" jdbcType="VARCHAR" property="brandNameEn" />
        <result column="brand_keyword" jdbcType="VARCHAR" property="brandKeyword" />
        <result column="hot_keyword" jdbcType="VARCHAR" property="hotKeyword" />
        <result column="status" property="status" jdbcType="INTEGER" />
        <result column="country_id" property="countryId" jdbcType="INTEGER" />
        <result column="brand_style" jdbcType="VARCHAR" property="brandStyle" />
        <result column="shelves_brand_time" property="shelvesBrandTime" jdbcType="INTEGER" />
    </resultMap>

    <sql id="Base_Column_List">
        id, brand_name, brand_domain, brand_alif, brand_ico,
        is_hot,
        brand_name_cn, brand_name_en,
        brand_keyword, hot_keyword,status,country_id,brand_style,shelves_brand_time
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
            parameterType="java.lang.Integer" timeout="20000">
        select
        <include refid="Base_Column_List" />
        from brand
        where id = #{id,jdbcType=INTEGER}
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
            timeout="20000">
        delete from brand
        where id = #{id,jdbcType=INTEGER}
    </delete>

    <insert id="insert" parameterType="com.yoho.search.dal.model.Brand"
            timeout="20000">
        insert ignore into brand (id, brand_name, brand_domain,
        brand_alif,
        brand_ico, is_hot,
        brand_name_cn, brand_name_en, brand_keyword,
        hot_keyword,status,country_id,brand_style,shelves_brand_time)
        values (
        #{id,jdbcType=INTEGER},
        #{brandName,jdbcType=VARCHAR},
        #{brandDomain,jdbcType=VARCHAR},
        #{brandAlif,jdbcType=VARCHAR},
        #{brandIco,jdbcType=VARCHAR},
        #{isHot,jdbcType=CHAR},
        #{brandNameCn,jdbcType=VARCHAR},
        #{brandNameEn,jdbcType=VARCHAR},
        #{brandKeyword,jdbcType=VARCHAR},
        #{hotKeyword,jdbcType=VARCHAR},
        #{status,jdbcType=INTEGER},
        #{countryId,jdbcType=INTEGER},
        #{brandStyle,jdbcType=VARCHAR},
        #{shelvesBrandTime,jdbcType=INTEGER}
        )
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.Brand"
            timeout="20000">
        update brand
        <set>
            <if test="brandName != null">
                brand_name = #{brandName,jdbcType=VARCHAR},
            </if>
            <if test="brandDomain != null">
                brand_domain = #{brandDomain,jdbcType=VARCHAR},
            </if>
            <if test="brandAlif != null">
                brand_alif = #{brandAlif,jdbcType=VARCHAR},
            </if>
            <if test="brandIco != null">
                brand_ico = #{brandIco,jdbcType=VARCHAR},
            </if>
            <if test="isHot != null">
                is_hot = #{isHot,jdbcType=CHAR},
            </if>
            <if test="brandNameCn != null">
                brand_name_cn = #{brandNameCn,jdbcType=VARCHAR},
            </if>
            <if test="brandNameEn != null">
                brand_name_en = #{brandNameEn,jdbcType=VARCHAR},
            </if>
            <if test="brandKeyword != null">
                brand_keyword = #{brandKeyword,jdbcType=VARCHAR},
            </if>
            <if test="hotKeyword != null">
                hot_keyword = #{hotKeyword,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="countryId != null">
                country_id = #{countryId,jdbcType=INTEGER},
            </if>
            <if test="brandStyle != null">
                brand_style = #{brandStyle,jdbcType=VARCHAR},
            </if>
            <if test="shelvesBrandTime != null">
                shelves_brand_time = #{shelvesBrandTime,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

    <select id="selectCount" resultType="java.lang.Integer" timeout="20000" >
        SELECT count(1) FROM brand
    </select>

    <select id="selectBrandPageLists" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List" />
        from brand limit #{offset},#{pageSize}
    </select>
</mapper>