<?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="org.linlinjava.jz.db.dao.JzCalllogRecordMapper">
  <resultMap id="BaseResultMap" type="org.linlinjava.jz.db.domain.JzCalllogRecord">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="call_id" jdbcType="INTEGER" property="callId" />
    <result column="customer_id" jdbcType="INTEGER" property="customerId" />
    <result column="ringingtime" jdbcType="INTEGER" property="ringingtime" />
    <result column="talktime" jdbcType="INTEGER" property="talktime" />
    <result column="connected" jdbcType="BIT" property="connected" />
    <result column="call_type" jdbcType="VARCHAR" property="callType" />
    <result column="call_source" jdbcType="VARCHAR" property="callSource" />
    <result column="record_url" jdbcType="VARCHAR" property="recordUrl" />
    <result column="record_id" jdbcType="VARCHAR" property="recordId" />
    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user" jdbcType="INTEGER" property="createUser" />
    <association property="customer" column="customer_id" javaType="org.linlinjava.jz.db.domain.CustomerClient" select="getCustomer"/>
  </resultMap>

  <select id="getCustomer" resultMap="BaseCustomerMap">
    select id,customer_name,tel from customer_client where  id = #{customer_id,jdbcType=INTEGER}
  </select>
  <resultMap id="BaseCustomerMap" type="org.linlinjava.jz.db.domain.CustomerClient">
    <result column="tel" jdbcType="VARCHAR" property="tel" />
    <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
    <result column="tel" jdbcType="VARCHAR" property="tel" />
  </resultMap>


  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    id, call_id, customer_id, ringingtime, talktime, connected, call_type, call_source, 
    record_url, record_id, mobile, create_time, create_user
  </sql>
  <select id="selectByExample" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecordExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from jz_calllog_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="example != null and example.distinct">
      distinct
    </if>
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from jz_calllog_record
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example != null and example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from jz_calllog_record
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from jz_calllog_record
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from jz_calllog_record
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecordExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from jz_calllog_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecord">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into jz_calllog_record (call_id, customer_id, ringingtime, 
      talktime, connected, call_type, 
      call_source, record_url, record_id, 
      mobile, create_time, create_user
      )
    values (#{callId,jdbcType=INTEGER}, #{customerId,jdbcType=INTEGER}, #{ringingtime,jdbcType=INTEGER}, 
      #{talktime,jdbcType=INTEGER}, #{connected,jdbcType=BIT}, #{callType,jdbcType=VARCHAR}, 
      #{callSource,jdbcType=VARCHAR}, #{recordUrl,jdbcType=VARCHAR}, #{recordId,jdbcType=VARCHAR}, 
      #{mobile,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecord">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into jz_calllog_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="callId != null">
        call_id,
      </if>
      <if test="customerId != null">
        customer_id,
      </if>
      <if test="ringingtime != null">
        ringingtime,
      </if>
      <if test="talktime != null">
        talktime,
      </if>
      <if test="connected != null">
        connected,
      </if>
      <if test="callType != null">
        call_type,
      </if>
      <if test="callSource != null">
        call_source,
      </if>
      <if test="recordUrl != null">
        record_url,
      </if>
      <if test="recordId != null">
        record_id,
      </if>
      <if test="mobile != null">
        mobile,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="callId != null">
        #{callId,jdbcType=INTEGER},
      </if>
      <if test="customerId != null">
        #{customerId,jdbcType=INTEGER},
      </if>
      <if test="ringingtime != null">
        #{ringingtime,jdbcType=INTEGER},
      </if>
      <if test="talktime != null">
        #{talktime,jdbcType=INTEGER},
      </if>
      <if test="connected != null">
        #{connected,jdbcType=BIT},
      </if>
      <if test="callType != null">
        #{callType,jdbcType=VARCHAR},
      </if>
      <if test="callSource != null">
        #{callSource,jdbcType=VARCHAR},
      </if>
      <if test="recordUrl != null">
        #{recordUrl,jdbcType=VARCHAR},
      </if>
      <if test="recordId != null">
        #{recordId,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecordExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from jz_calllog_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_calllog_record
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.callId != null">
        call_id = #{record.callId,jdbcType=INTEGER},
      </if>
      <if test="record.customerId != null">
        customer_id = #{record.customerId,jdbcType=INTEGER},
      </if>
      <if test="record.ringingtime != null">
        ringingtime = #{record.ringingtime,jdbcType=INTEGER},
      </if>
      <if test="record.talktime != null">
        talktime = #{record.talktime,jdbcType=INTEGER},
      </if>
      <if test="record.connected != null">
        connected = #{record.connected,jdbcType=BIT},
      </if>
      <if test="record.callType != null">
        call_type = #{record.callType,jdbcType=VARCHAR},
      </if>
      <if test="record.callSource != null">
        call_source = #{record.callSource,jdbcType=VARCHAR},
      </if>
      <if test="record.recordUrl != null">
        record_url = #{record.recordUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.recordId != null">
        record_id = #{record.recordId,jdbcType=VARCHAR},
      </if>
      <if test="record.mobile != null">
        mobile = #{record.mobile,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUser != null">
        create_user = #{record.createUser,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_calllog_record
    set id = #{record.id,jdbcType=INTEGER},
      call_id = #{record.callId,jdbcType=INTEGER},
      customer_id = #{record.customerId,jdbcType=INTEGER},
      ringingtime = #{record.ringingtime,jdbcType=INTEGER},
      talktime = #{record.talktime,jdbcType=INTEGER},
      connected = #{record.connected,jdbcType=BIT},
      call_type = #{record.callType,jdbcType=VARCHAR},
      call_source = #{record.callSource,jdbcType=VARCHAR},
      record_url = #{record.recordUrl,jdbcType=VARCHAR},
      record_id = #{record.recordId,jdbcType=VARCHAR},
      mobile = #{record.mobile,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_user = #{record.createUser,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecord">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_calllog_record
    <set>
      <if test="callId != null">
        call_id = #{callId,jdbcType=INTEGER},
      </if>
      <if test="customerId != null">
        customer_id = #{customerId,jdbcType=INTEGER},
      </if>
      <if test="ringingtime != null">
        ringingtime = #{ringingtime,jdbcType=INTEGER},
      </if>
      <if test="talktime != null">
        talktime = #{talktime,jdbcType=INTEGER},
      </if>
      <if test="connected != null">
        connected = #{connected,jdbcType=BIT},
      </if>
      <if test="callType != null">
        call_type = #{callType,jdbcType=VARCHAR},
      </if>
      <if test="callSource != null">
        call_source = #{callSource,jdbcType=VARCHAR},
      </if>
      <if test="recordUrl != null">
        record_url = #{recordUrl,jdbcType=VARCHAR},
      </if>
      <if test="recordId != null">
        record_id = #{recordId,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        mobile = #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecord">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jz_calllog_record
    set call_id = #{callId,jdbcType=INTEGER},
      customer_id = #{customerId,jdbcType=INTEGER},
      ringingtime = #{ringingtime,jdbcType=INTEGER},
      talktime = #{talktime,jdbcType=INTEGER},
      connected = #{connected,jdbcType=BIT},
      call_type = #{callType,jdbcType=VARCHAR},
      call_source = #{callSource,jdbcType=VARCHAR},
      record_url = #{recordUrl,jdbcType=VARCHAR},
      record_id = #{recordId,jdbcType=VARCHAR},
      mobile = #{mobile,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user = #{createUser,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectOneByExample" parameterType="org.linlinjava.jz.db.domain.JzCalllogRecordExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <include refid="Base_Column_List" />
    from jz_calllog_record
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    limit 1
  </select>
  <select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <choose>
      <when test="selective != null and selective.length &gt; 0">
        <foreach collection="selective" item="column" separator=",">
          ${column.aliasedEscapedColumnName}
        </foreach>
      </when>
      <otherwise>
        <include refid="Base_Column_List" />
      </otherwise>
    </choose>
    from jz_calllog_record
    <if test="example != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example != null and example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
    limit 1
  </select>
</mapper>