CustomerOuterMapper.xml 3.1 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.CustomerOuterMapper" >
  <resultMap id="BaseResultMap" type="cn.runsa.crmapp.customer.entity.CustomerOuter" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <result column="CST_ID" property="cstId" jdbcType="BIGINT" />
    <result column="ACT_ID" property="actId" jdbcType="BIGINT" />
    <result column="CARD_ID" property="cardId" jdbcType="VARCHAR" />
    <result column="REC_TIME" property="recTime" jdbcType="TIMESTAMP" />
    <result column="REC_USER" property="recUser" jdbcType="BIGINT" />
  </resultMap>
  <insert id="insert" parameterType="cn.runsa.crmapp.customer.entity.CustomerOuter" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert ignore into crm_customer_old (`CST_ID`, `ACT_ID`, `CARD_ID`, 
      `REC_TIME`, `REC_USER`)
    values (#{cstId,jdbcType=BIGINT}, #{actId,jdbcType=BIGINT}, #{cardId,jdbcType=VARCHAR}, 
      #{recTime,jdbcType=TIMESTAMP}, #{recUser,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="cn.runsa.crmapp.customer.entity.CustomerOuter" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert ignore into crm_customer_old
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="cstId != null" >
        `CST_ID`,
      </if>
      <if test="actId != null" >
        `ACT_ID`,
      </if>
      <if test="cardId != null" >
        `CARD_ID`,
      </if>
      <if test="recTime != null" >
        `REC_TIME`,
      </if>
      <if test="recUser != null" >
        `REC_USER`,
      </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="cardId != null" >
        #{cardId,jdbcType=VARCHAR},
      </if>
      <if test="recTime != null" >
        #{recTime,jdbcType=TIMESTAMP},
      </if>
      <if test="recUser != null" >
        #{recUser,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  
  <select id="selectByCstIdUnion" parameterType="map" resultMap="BaseResultMap">
  	SELECT * FROM crm_customer_old WHERE CST_ID = #{cstId}
  	AND ACT_ID = #{actId}
  </select>
  
  <select id="selectByOutIdUnion" parameterType="map" resultMap="BaseResultMap">
  	SELECT * FROM crm_customer_old WHERE CARD_ID = #{card}
  	AND ACT_ID = #{actId}
  </select>
  
  <select id="selectByCstId" parameterType="map" resultMap="BaseResultMap">
  	SELECT * FROM crm_customer_old WHERE CST_ID = #{cstId}
  </select>
  
  <select id="selectByCsts"  resultMap="BaseResultMap">
  	SELECT * FROM crm_customer_old WHERE CST_ID in 
  	<foreach collection="list" item="it" separator="," open="(" close=")">
  		#{it}
  	</foreach>
  </select>
</mapper>