CustomerChangeMapper.xml 3.38 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.runsa.crmapp.customer.mapper.CustomerChangeMapper">
  <resultMap id="BaseResultMap" type="cn.runsa.crmapp.customer.entity.CustomerChange">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <result column="CST_ID" jdbcType="BIGINT" property="cstId" />
    <result column="ACT_ID" jdbcType="BIGINT" property="actId" />
    <result column="CST_TYPE" jdbcType="TINYINT" property="cstType" />
    <result column="CST_RANK" jdbcType="VARCHAR" property="cstRank" />
    <result column="S_TIME" jdbcType="TIMESTAMP" property="sTime" />
    <result column="E_TIME" jdbcType="TIMESTAMP" property="eTime" />
    <result column="REC_TIME" jdbcType="TIMESTAMP" property="recTime" />
  </resultMap>
  <insert id="insert" parameterType="cn.runsa.crmapp.customer.entity.CustomerChange">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into crm_customer_change (`CST_ID`, `ACT_ID`, `CST_TYPE`, 
      `CST_RANK`, `S_TIME`, `E_TIME`, 
      `REC_TIME`)
    values (#{cstId,jdbcType=BIGINT}, #{actId,jdbcType=BIGINT}, #{cstType,jdbcType=TINYINT}, 
      #{cstRank,jdbcType=VARCHAR}, #{sTime,jdbcType=TIMESTAMP}, #{eTime,jdbcType=TIMESTAMP}, 
      #{recTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="cn.runsa.crmapp.customer.entity.CustomerChange">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into crm_customer_change
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="cstId != null">
        `CST_ID`,
      </if>
      <if test="actId != null">
        `ACT_ID`,
      </if>
      <if test="cstType != null">
        `CST_TYPE`,
      </if>
      <if test="cstRank != null">
        `CST_RANK`,
      </if>
      <if test="sTime != null">
        `S_TIME`,
      </if>
      <if test="eTime != null">
        `E_TIME`,
      </if>
      <if test="recTime != null">
        `REC_TIME`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="cstId != null">
        #{cstId,jdbcType=BIGINT},
      </if>
      <if test="actId != null">
        #{actId,jdbcType=BIGINT},
      </if>
      <if test="cstType != null">
        #{cstType,jdbcType=TINYINT},
      </if>
      <if test="cstRank != null">
        #{cstRank,jdbcType=VARCHAR},
      </if>
      <if test="sTime != null">
        #{sTime,jdbcType=TIMESTAMP},
      </if>
      <if test="eTime != null">
        #{eTime,jdbcType=TIMESTAMP},
      </if>
      <if test="recTime != null">
        #{recTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <insert id="insertOrUpdateRankChanges">
  	INSERT INTO `crm_customer_change`
            (`CST_ID`,
             `ACT_ID`,
             `CST_RANK`,
             `S_TIME`,
             `E_TIME`)
	VALUES 
  	<foreach collection="list" item="it" separator=",">
  	(#{it.cstId,jdbcType=BIGINT}, #{it.actId,jdbcType=BIGINT},#{it.cstRank,jdbcType=VARCHAR}, 
      #{it.sTime,jdbcType=TIMESTAMP}, #{it.eTime,jdbcType=TIMESTAMP})
  	</foreach> 
  	ON DUPLICATE KEY UPDATE 
  	`E_TIME` = values(`E_TIME`)
  </insert>
</mapper>