CustomerActionStatisticsMapper.xml 15.9 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="cn.com.glsx.openplatform.mapper.CustomerActionStatisticsMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.openplatform.model.CustomerActionStatistics">
        <!--@mbg.generated-->
        <!--@Table t_customer_action_statistics-->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="customer_id" jdbcType="INTEGER" property="customerId"/>
        <result column="customer_name" jdbcType="VARCHAR" property="customerName"/>
        <result column="type" jdbcType="VARCHAR" property="type"/>
        <result column="statistics_time" jdbcType="VARCHAR" property="statisticsTime"/>
        <result column="active_number" jdbcType="INTEGER" property="activeNumber"/>
        <result column="activation_growth" jdbcType="INTEGER" property="activationGrowth"/>
    </resultMap>

    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, customer_id, customer_name, `type`, statistics_time, active_number, activation_growth
    </sql>

    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        <!--@mbg.generated-->
        select
        <include refid="Base_Column_List"/>
        from t_customer_action_statistics
        where id = #{id,jdbcType=INTEGER}
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        <!--@mbg.generated-->
        delete
        from t_customer_action_statistics
        where id = #{id,jdbcType=INTEGER}
    </delete>

    <insert id="insert" keyColumn="id" keyProperty="id"
            parameterType="cn.com.glsx.openplatform.model.CustomerActionStatistics"
            useGeneratedKeys="true">
        <!--@mbg.generated-->
        <selectKey order="AFTER" keyProperty="id" resultType="integer">
            select LAST_INSERT_ID()
        </selectKey>
        insert into t_customer_action_statistics (customer_id, customer_name, `type`,
            statistics_time, active_number, activation_growth)
        values (#{customerId,jdbcType=INTEGER}, #{customerName,jdbcType=VARCHAR},
            #{type,jdbcType=VARCHAR},
            #{statisticsTime,jdbcType=VARCHAR}, #{activeNumber,jdbcType=INTEGER},
            #{activationGrowth,jdbcType=INTEGER})
    </insert>

    <insert id="insertSelective" keyColumn="id" keyProperty="id"
            parameterType="cn.com.glsx.openplatform.model.CustomerActionStatistics"
            useGeneratedKeys="true">
        <!--@mbg.generated-->
        <selectKey order="AFTER" keyProperty="id" resultType="integer">
            select LAST_INSERT_ID()
        </selectKey>
        insert into t_customer_action_statistics
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="customerId != null">
                customer_id,
            </if>
            <if test="customerName != null and customerName != ''">
                customer_name,
            </if>
            <if test="type != null and type != ''">
                `type`,
            </if>
            <if test="statisticsTime != null and statisticsTime != ''">
                statistics_time,
            </if>
            <if test="activeNumber != null">
                active_number,
            </if>
            <if test="activationGrowth != null">
                activation_growth,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="customerId != null">
                #{customerId,jdbcType=INTEGER},
            </if>
            <if test="customerName != null and customerName != ''">
                #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="type != null and type != ''">
                #{type,jdbcType=VARCHAR},
            </if>
            <if test="statisticsTime != null and statisticsTime != ''">
                #{statisticsTime,jdbcType=VARCHAR},
            </if>
            <if test="activeNumber != null">
                #{activeNumber,jdbcType=INTEGER},
            </if>
            <if test="activationGrowth != null">
                #{activationGrowth,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective"
            parameterType="cn.com.glsx.openplatform.model.CustomerActionStatistics">
        <!--@mbg.generated-->
        update t_customer_action_statistics
        <set>
            <if test="customerId != null">
                customer_id = #{customerId,jdbcType=INTEGER},
            </if>
            <if test="customerName != null and customerName != ''">
                customer_name = #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="type != null and type != ''">
                `type` = #{type,jdbcType=VARCHAR},
            </if>
            <if test="statisticsTime != null and statisticsTime != ''">
                statistics_time = #{statisticsTime,jdbcType=VARCHAR},
            </if>
            <if test="activeNumber != null">
                active_number = #{activeNumber,jdbcType=INTEGER},
            </if>
            <if test="activationGrowth != null">
                activation_growth = #{activationGrowth,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>

    <update id="updateByPrimaryKey"
            parameterType="cn.com.glsx.openplatform.model.CustomerActionStatistics">
        <!--@mbg.generated-->
        update t_customer_action_statistics
        set customer_id = #{customerId,jdbcType=INTEGER},
                customer_name = #{customerName,jdbcType=VARCHAR},
                `type` = #{type,jdbcType=VARCHAR},
                statistics_time = #{statisticsTime,jdbcType=VARCHAR},
                active_number = #{activeNumber,jdbcType=INTEGER},
                activation_growth = #{activationGrowth,jdbcType=INTEGER}
        where id = #{id,jdbcType=INTEGER}
    </update>

    <update id="updateBatch" parameterType="java.util.List">
        <!--@mbg.generated-->
        update t_customer_action_statistics
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="customer_id = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.customerId,jdbcType=INTEGER}
                </foreach>
            </trim>
            <trim prefix="customer_name = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.customerName,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="`type` = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="statistics_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER}
                            then #{item.statisticsTime,jdbcType=VARCHAR}
                </foreach>
            </trim>
            <trim prefix="active_number = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER} then #{item.activeNumber,jdbcType=INTEGER}
                </foreach>
            </trim>
            <trim prefix="activation_growth = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    when id = #{item.id,jdbcType=INTEGER}
                            then #{item.activationGrowth,jdbcType=INTEGER}
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach close=")" collection="list" item="item" open="(" separator=", ">
            #{item.id,jdbcType=INTEGER}
        </foreach>
    </update>

    <update id="updateBatchSelective" parameterType="java.util.List">
        <!--@mbg.generated-->
        update t_customer_action_statistics
        <trim prefix="set" suffixOverrides=",">
            <trim prefix="customer_id = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.customerId != null">
                        when id = #{item.id,jdbcType=INTEGER}
                                then #{item.customerId,jdbcType=INTEGER}
                    </if>
                </foreach>
            </trim>
            <trim prefix="customer_name = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.customerName != null">
                        when id = #{item.id,jdbcType=INTEGER}
                                then #{item.customerName,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="`type` = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.type != null">
                        when id = #{item.id,jdbcType=INTEGER} then #{item.type,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="statistics_time = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.statisticsTime != null">
                        when id = #{item.id,jdbcType=INTEGER}
                                then #{item.statisticsTime,jdbcType=VARCHAR}
                    </if>
                </foreach>
            </trim>
            <trim prefix="active_number = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.activeNumber != null">
                        when id = #{item.id,jdbcType=INTEGER}
                                then #{item.activeNumber,jdbcType=INTEGER}
                    </if>
                </foreach>
            </trim>
            <trim prefix="activation_growth = case" suffix="end,">
                <foreach collection="list" index="index" item="item">
                    <if test="item.activationGrowth != null">
                        when id = #{item.id,jdbcType=INTEGER}
                                then #{item.activationGrowth,jdbcType=INTEGER}
                    </if>
                </foreach>
            </trim>
        </trim>
        where id in
        <foreach close=")" collection="list" item="item" open="(" separator=", ">
            #{item.id,jdbcType=INTEGER}
        </foreach>
    </update>

    <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map"
            useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into t_customer_action_statistics
                (customer_id, customer_name, `type`, statistics_time, active_number,
                 activation_growth)
                values
        <foreach collection="list" item="item" separator=",">
            (#{item.customerId,jdbcType=INTEGER}, #{item.customerName,jdbcType=VARCHAR},
             #{item.type,jdbcType=VARCHAR},
             #{item.statisticsTime,jdbcType=VARCHAR}, #{item.activeNumber,jdbcType=INTEGER},
             #{item.activationGrowth,jdbcType=INTEGER})
        </foreach>
    </insert>

    <insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
            parameterType="cn.com.glsx.openplatform.model.CustomerActionStatistics"
            useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into t_customer_action_statistics
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            customer_id,
            customer_name,
            `type`,
            statistics_time,
            active_number,
            activation_growth,
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            #{customerId,jdbcType=INTEGER},
            #{customerName,jdbcType=VARCHAR},
            #{type,jdbcType=VARCHAR},
            #{statisticsTime,jdbcType=VARCHAR},
            #{activeNumber,jdbcType=INTEGER},
            #{activationGrowth,jdbcType=INTEGER},
        </trim>
        on duplicate key update
        <trim suffixOverrides=",">
            <if test="id != null">
                id = #{id,jdbcType=INTEGER},
            </if>
            customer_id = #{customerId,jdbcType=INTEGER},
                    customer_name = #{customerName,jdbcType=VARCHAR},
                    `type` = #{type,jdbcType=VARCHAR},
                    statistics_time = #{statisticsTime,jdbcType=VARCHAR},
                    active_number = #{activeNumber,jdbcType=INTEGER},
                    activation_growth = #{activationGrowth,jdbcType=INTEGER},
        </trim>
    </insert>

    <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
            parameterType="cn.com.glsx.openplatform.model.CustomerActionStatistics"
            useGeneratedKeys="true">
        <!--@mbg.generated-->
        insert into t_customer_action_statistics
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="customerId != null">
                customer_id,
            </if>
            <if test="customerName != null and customerName != ''">
                customer_name,
            </if>
            <if test="type != null and type != ''">
                `type`,
            </if>
            <if test="statisticsTime != null and statisticsTime != ''">
                statistics_time,
            </if>
            <if test="activeNumber != null">
                active_number,
            </if>
            <if test="activationGrowth != null">
                activation_growth,
            </if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="customerId != null">
                #{customerId,jdbcType=INTEGER},
            </if>
            <if test="customerName != null and customerName != ''">
                #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="type != null and type != ''">
                #{type,jdbcType=VARCHAR},
            </if>
            <if test="statisticsTime != null and statisticsTime != ''">
                #{statisticsTime,jdbcType=VARCHAR},
            </if>
            <if test="activeNumber != null">
                #{activeNumber,jdbcType=INTEGER},
            </if>
            <if test="activationGrowth != null">
                #{activationGrowth,jdbcType=INTEGER},
            </if>
        </trim>
        on duplicate key update
        <trim suffixOverrides=",">
            <if test="id != null">
                id = #{id,jdbcType=INTEGER},
            </if>
            <if test="customerId != null">
                customer_id = #{customerId,jdbcType=INTEGER},
            </if>
            <if test="customerName != null and customerName != ''">
                customer_name = #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="type != null and type != ''">
                `type` = #{type,jdbcType=VARCHAR},
            </if>
            <if test="statisticsTime != null and statisticsTime != ''">
                statistics_time = #{statisticsTime,jdbcType=VARCHAR},
            </if>
            <if test="activeNumber != null">
                active_number = #{activeNumber,jdbcType=INTEGER},
            </if>
            <if test="activationGrowth != null">
                activation_growth = #{activationGrowth,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>
</mapper>