<?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.ms.dal.mapper.DsMessageConsumerBufferMapper">

    <resultMap id="BaseResultMap" type="com.ms.dal.entity.DsMessageConsumerBuffer">
            <id property="dsMessageConsumerBufferId" column="ds_message_consumer_buffer_id" jdbcType="BIGINT"/>
            <result property="shopId" column="shop_id" jdbcType="BIGINT"/>
            <result property="dsMessageId" column="ds_message_id" jdbcType="BIGINT"/>
            <result property="gmtExec" column="gmt_exec" jdbcType="TIMESTAMP"/>
            <result property="gmtCreate" column="gmt_create" jdbcType="TIMESTAMP"/>
            <result property="gmtModified" column="gmt_modified" jdbcType="TIMESTAMP"/>
    </resultMap>

    <sql id="Base_Column_List">
        ds_message_consumer_buffer_id,shop_id,ds_message_id,
        gmt_exec,gmt_create,gmt_modified
    </sql>

    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ds_message_consumer_buffer
        where  ds_message_consumer_buffer_id = #{dsMessageConsumerBufferId,jdbcType=BIGINT} 
    </select>
    <select id="getListPrimaryKeyBiggerThan" resultType="com.ms.dal.entity.DsMessageConsumerBuffer">
        select
        <include refid="Base_Column_List" />
        from ds_message_consumer_buffer
        where  ds_message_consumer_buffer_id > #{id,jdbcType=BIGINT}
        limit #{limit}
    </select>
    <delete id="deleteByIdList">
        delete from ds_message_consumer_buffer
        where  ds_message_consumer_buffer_id IN
        <foreach collection="deleteBufferIds" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from ds_message_consumer_buffer
        where  ds_message_consumer_buffer_id = #{dsMessageConsumerBufferId,jdbcType=BIGINT} 
    </delete>
    <insert id="insert" keyColumn="ds_message_consumer_buffer_id" keyProperty="dsMessageConsumerBufferId" parameterType="com.ms.dal.entity.DsMessageConsumerBuffer" useGeneratedKeys="true">
        insert into ds_message_consumer_buffer
        ( ds_message_consumer_buffer_id,shop_id,ds_message_id
        ,gmt_exec,gmt_create,gmt_modified
        )
        values (#{dsMessageConsumerBufferId,jdbcType=BIGINT},#{shopId,jdbcType=BIGINT},#{dsMessageId,jdbcType=BIGINT}
        ,#{gmtExec,jdbcType=TIMESTAMP},#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP}
        )
    </insert>
    <insert id="insertSelective" keyColumn="ds_message_consumer_buffer_id" keyProperty="dsMessageConsumerBufferId" parameterType="com.ms.dal.entity.DsMessageConsumerBuffer" useGeneratedKeys="true">
        insert into ds_message_consumer_buffer
        <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="dsMessageConsumerBufferId != null">ds_message_consumer_buffer_id,</if>
                <if test="shopId != null">shop_id,</if>
                <if test="dsMessageId != null">ds_message_id,</if>
                <if test="gmtExec != null">gmt_exec,</if>
                <if test="gmtCreate != null">gmt_create,</if>
                <if test="gmtModified != null">gmt_modified,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                <if test="dsMessageConsumerBufferId != null">#{dsMessageConsumerBufferId,jdbcType=BIGINT},</if>
                <if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
                <if test="dsMessageId != null">#{dsMessageId,jdbcType=BIGINT},</if>
                <if test="gmtExec != null">#{gmtExec,jdbcType=TIMESTAMP},</if>
                <if test="gmtCreate != null">#{gmtCreate,jdbcType=TIMESTAMP},</if>
                <if test="gmtModified != null">#{gmtModified,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.ms.dal.entity.DsMessageConsumerBuffer">
        update ds_message_consumer_buffer
        <set>
                <if test="shopId != null">
                    shop_id = #{shopId,jdbcType=BIGINT},
                </if>
                <if test="dsMessageId != null">
                    ds_message_id = #{dsMessageId,jdbcType=BIGINT},
                </if>
                <if test="gmtExec != null">
                    gmt_exec = #{gmtExec,jdbcType=TIMESTAMP},
                </if>
                <if test="gmtCreate != null">
                    gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
                </if>
                <if test="gmtModified != null">
                    gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
                </if>
        </set>
        where   ds_message_consumer_buffer_id = #{dsMessageConsumerBufferId,jdbcType=BIGINT} 
    </update>
    <update id="updateByPrimaryKey" parameterType="com.ms.dal.entity.DsMessageConsumerBuffer">
        update ds_message_consumer_buffer
        set 
            shop_id =  #{shopId,jdbcType=BIGINT},
            ds_message_id =  #{dsMessageId,jdbcType=BIGINT},
            gmt_exec =  #{gmtExec,jdbcType=TIMESTAMP},
            gmt_create =  #{gmtCreate,jdbcType=TIMESTAMP},
            gmt_modified =  #{gmtModified,jdbcType=TIMESTAMP}
        where   ds_message_consumer_buffer_id = #{dsMessageConsumerBufferId,jdbcType=BIGINT} 
    </update>
</mapper>
