CustomerSuggestMapper.xml 6.68 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.CustomerSuggestMapper" >
  <resultMap id="BaseResultMap" type="cn.runsa.crmapp.customer.entity.CustomerSuggest" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="FROM" property="from" jdbcType="BIGINT" />
    <result column="TO" property="to" jdbcType="BIGINT" />
    <result column="SOURCE" property="source" jdbcType="VARCHAR" />
    <result column="SOURCE_ID" property="sourceId" jdbcType="VARCHAR" />
    <result column="REC_TIME" property="recTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="cn.runsa.crmapp.customer.entity.CustomerSuggest" extends="BaseResultMap" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <result column="CONTENT" property="content" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    `ID`, `FROM`, `TO`, `SOURCE`, `SOURCE_ID`, `REC_TIME`
  </sql>
  <sql id="Blob_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    `CONTENT`
  </sql>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from crm_customer_suggest
    where `ID` = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from crm_customer_suggest
    where `ID` = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="cn.runsa.crmapp.customer.entity.CustomerSuggest" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into crm_customer_suggest (`ID`, `FROM`, `TO`, `SOURCE`, 
      `SOURCE_ID`, `REC_TIME`, `CONTENT`
      )
    values (#{id,jdbcType=INTEGER}, #{from,jdbcType=BIGINT}, #{to,jdbcType=BIGINT}, #{source,jdbcType=VARCHAR}, 
      #{sourceId,jdbcType=VARCHAR}, #{recTime,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.runsa.crmapp.customer.entity.CustomerSuggest" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into crm_customer_suggest
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        `ID`,
      </if>
      <if test="from != null" >
        `FROM`,
      </if>
      <if test="to != null" >
        `TO`,
      </if>
      <if test="source != null" >
        `SOURCE`,
      </if>
      <if test="sourceId != null" >
        `SOURCE_ID`,
      </if>
      <if test="recTime != null" >
        `REC_TIME`,
      </if>
      <if test="content != null" >
        `CONTENT`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="from != null" >
        #{from,jdbcType=BIGINT},
      </if>
      <if test="to != null" >
        #{to,jdbcType=BIGINT},
      </if>
      <if test="source != null" >
        #{source,jdbcType=VARCHAR},
      </if>
      <if test="sourceId != null" >
        #{sourceId,jdbcType=VARCHAR},
      </if>
      <if test="recTime != null" >
        #{recTime,jdbcType=TIMESTAMP},
      </if>
      <if test="content != null" >
        #{content,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.runsa.crmapp.customer.entity.CustomerSuggest" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update crm_customer_suggest
    <set >
      <if test="from != null" >
        `FROM` = #{from,jdbcType=BIGINT},
      </if>
      <if test="to != null" >
        `TO` = #{to,jdbcType=BIGINT},
      </if>
      <if test="source != null" >
        `SOURCE` = #{source,jdbcType=VARCHAR},
      </if>
      <if test="sourceId != null" >
        `SOURCE_ID` = #{sourceId,jdbcType=VARCHAR},
      </if>
      <if test="recTime != null" >
        `REC_TIME` = #{recTime,jdbcType=TIMESTAMP},
      </if>
      <if test="content != null" >
        `CONTENT` = #{content,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where `ID` = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.runsa.crmapp.customer.entity.CustomerSuggest" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update crm_customer_suggest
    set `FROM` = #{from,jdbcType=BIGINT},
      `TO` = #{to,jdbcType=BIGINT},
      `SOURCE` = #{source,jdbcType=VARCHAR},
      `SOURCE_ID` = #{sourceId,jdbcType=VARCHAR},
      `REC_TIME` = #{recTime,jdbcType=TIMESTAMP},
      `CONTENT` = #{content,jdbcType=LONGVARCHAR}
    where `ID` = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.runsa.crmapp.customer.entity.CustomerSuggest" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update crm_customer_suggest
    set `FROM` = #{from,jdbcType=BIGINT},
      `TO` = #{to,jdbcType=BIGINT},
      `SOURCE` = #{source,jdbcType=VARCHAR},
      `SOURCE_ID` = #{sourceId,jdbcType=VARCHAR},
      `REC_TIME` = #{recTime,jdbcType=TIMESTAMP}
    where `ID` = #{id,jdbcType=INTEGER}
  </update>
  
  <select id="selectByCstid" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from crm_customer_suggest
    where `from` = #{cstId,jdbcType=BIGINT}
    or `to` = #{cstId,jdbcType=BIGINT}
    order by rec_time desc
    limit #{start,jdbcType=INTEGER},#{size,jdbcType=INTEGER}
  </select>
</mapper>