CsBrandKeywordMapper.xml 2.18 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.CsBrandKeywordMapper">

    <resultMap id="BaseResultMap" type="com.yoho.search.dal.model.CsBrandKeyword">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="brand_id" property="brandId" jdbcType="INTEGER"/>
        <result column="keyword" property="keyword" jdbcType="VARCHAR" />
        <result column="status" property="status" jdbcType="INTEGER"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
       id, brand_id, keyword, status, update_time
    </sql>

    <insert id="insert" parameterType="com.yoho.search.dal.model.CsBrandKeyword" timeout="20000">
       insert ignore into cs_brand_keyword (id, brand_id, keyword, status, update_time)
        values (#{id,jdbcType=INTEGER},#{brandId,jdbcType=INTEGER}, #{keyword,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},#{updateTime,jdbcType=VARCHAR})
    </insert>

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

    <update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.CsBrandKeyword" timeout="20000">
        update cs_brand_keyword
        <set>
            <if test="keyword != null">
                keyword = #{keyword,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

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

    <select id="selectAll" resultMap="BaseResultMap" timeout="20000">
        select
        <include refid="Base_Column_List" />
        from cs_brand_keyword where status = 1
    </select>
</mapper>