UfoBrandMapper.xml 4.09 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.UfoBrandMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.ufo_product.Brand">
        <id column="id" property="id" jdbcType="SMALLINT"/>
        <result column="brand_name" property="brandName" jdbcType="VARCHAR"/>
        <result column="brand_name_en" property="brandNameEn" jdbcType="VARCHAR"/>
        <result column="brand_logo" property="brandLogo" jdbcType="VARCHAR"/>
        <result column="brand_search" property="brandSearch" jdbcType="VARCHAR"/>
        <result column="status" property="status" jdbcType="TINYINT"/>
    </resultMap>

    <sql id="Base_Column_List">
    id, brand_name, brand_name_en, brand_logo, brand_search, status
    </sql>

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

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
    delete from brand
    where id = #{id,jdbcType=SMALLINT}
    </delete>

    <insert id="insertSelective" parameterType="com.yoho.search.dal.model.ufo_product.Brand" >
        insert into brand
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                id,
            </if>
            <if test="brandName != null" >
                brand_name,
            </if>
            <if test="brandNameEn != null" >
                brand_name_en,
            </if>
            <if test="brandLogo != null" >
                brand_logo,
            </if>
            <if test="brandSearch != null" >
                brand_search,
            </if>
            <if test="status != null" >
                status,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                #{id,jdbcType=SMALLINT},
            </if>
            <if test="brandName != null" >
                #{brandName,jdbcType=VARCHAR},
            </if>
            <if test="brandNameEn != null" >
                #{brandNameEn,jdbcType=VARCHAR},
            </if>
            <if test="brandLogo != null" >
                #{brandLogo,jdbcType=VARCHAR},
            </if>
            <if test="brandSearch != null" >
                #{brandSearch,jdbcType=VARCHAR},
            </if>
            <if test="status != null" >
                #{status,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.ufo_product.Brand">
        update brand
        <set>
            <if test="brandName != null">
                brand_name = #{brandName,jdbcType=VARCHAR},
            </if>
            <if test="brandNameEn != null">
                brand_name_en = #{brandNameEn,jdbcType=VARCHAR},
            </if>
            <if test="brandLogo != null">
                brand_logo = #{brandLogo,jdbcType=VARCHAR},
            </if>
            <if test="brandSearch != null">
                brand_search = #{brandSearch,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=TINYINT},
            </if>
        </set>
        where id = #{id,jdbcType=SMALLINT}
    </update>


    <select id="selectByIdList" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List"/>
        from brand
        WHERE
        id in
        <foreach item="item" index="index" collection="list"
                 open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>


    <select id="selectCount" resultType="java.lang.Integer" timeout="20000">
    select count(*) from brand
    </select>

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

</mapper>