<?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="com.chaozhanggui.dao.system.dao.TbPlussMerchantBackLklMapper">
  <resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussMerchantBackLkl">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="merchant_code" jdbcType="VARCHAR" property="merchantCode" />
    <result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
    <result column="channel" jdbcType="VARCHAR" property="channel" />
    <result column="user_no" jdbcType="VARCHAR" property="userNo" />
    <result column="customer_no" jdbcType="VARCHAR" property="customerNo" />
    <result column="external_customer_no" jdbcType="VARCHAR" property="externalCustomerNo" />
    <result column="term_nos" jdbcType="VARCHAR" property="termNos" />
    <result column="agency_no" jdbcType="VARCHAR" property="agencyNo" />
    <result column="active_no" jdbcType="VARCHAR" property="activeNo" />
    <result column="contract_id" jdbcType="VARCHAR" property="contractId" />
    <result column="core_term_ids" jdbcType="VARCHAR" property="coreTermIds" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, merchant_code, merchant_id, channel, user_no, customer_no, external_customer_no, 
    term_nos, agency_no, active_no, contract_id, core_term_ids, create_time, update_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from tb_pluss_merchant_back_lkl
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from tb_pluss_merchant_back_lkl
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantBackLkl">
    insert into tb_pluss_merchant_back_lkl (id, merchant_code, merchant_id, 
      channel, user_no, customer_no, 
      external_customer_no, term_nos, agency_no, 
      active_no, contract_id, core_term_ids, 
      create_time, update_time)
    values (#{id,jdbcType=INTEGER}, #{merchantCode,jdbcType=VARCHAR}, #{merchantId,jdbcType=VARCHAR}, 
      #{channel,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{customerNo,jdbcType=VARCHAR}, 
      #{externalCustomerNo,jdbcType=VARCHAR}, #{termNos,jdbcType=VARCHAR}, #{agencyNo,jdbcType=VARCHAR}, 
      #{activeNo,jdbcType=VARCHAR}, #{contractId,jdbcType=VARCHAR}, #{coreTermIds,jdbcType=VARCHAR}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantBackLkl">
    insert into tb_pluss_merchant_back_lkl
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="merchantCode != null">
        merchant_code,
      </if>
      <if test="merchantId != null">
        merchant_id,
      </if>
      <if test="channel != null">
        channel,
      </if>
      <if test="userNo != null">
        user_no,
      </if>
      <if test="customerNo != null">
        customer_no,
      </if>
      <if test="externalCustomerNo != null">
        external_customer_no,
      </if>
      <if test="termNos != null">
        term_nos,
      </if>
      <if test="agencyNo != null">
        agency_no,
      </if>
      <if test="activeNo != null">
        active_no,
      </if>
      <if test="contractId != null">
        contract_id,
      </if>
      <if test="coreTermIds != null">
        core_term_ids,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="merchantCode != null">
        #{merchantCode,jdbcType=VARCHAR},
      </if>
      <if test="merchantId != null">
        #{merchantId,jdbcType=VARCHAR},
      </if>
      <if test="channel != null">
        #{channel,jdbcType=VARCHAR},
      </if>
      <if test="userNo != null">
        #{userNo,jdbcType=VARCHAR},
      </if>
      <if test="customerNo != null">
        #{customerNo,jdbcType=VARCHAR},
      </if>
      <if test="externalCustomerNo != null">
        #{externalCustomerNo,jdbcType=VARCHAR},
      </if>
      <if test="termNos != null">
        #{termNos,jdbcType=VARCHAR},
      </if>
      <if test="agencyNo != null">
        #{agencyNo,jdbcType=VARCHAR},
      </if>
      <if test="activeNo != null">
        #{activeNo,jdbcType=VARCHAR},
      </if>
      <if test="contractId != null">
        #{contractId,jdbcType=VARCHAR},
      </if>
      <if test="coreTermIds != null">
        #{coreTermIds,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantBackLkl">
    update tb_pluss_merchant_back_lkl
    <set>
      <if test="merchantCode != null">
        merchant_code = #{merchantCode,jdbcType=VARCHAR},
      </if>
      <if test="merchantId != null">
        merchant_id = #{merchantId,jdbcType=VARCHAR},
      </if>
      <if test="channel != null">
        channel = #{channel,jdbcType=VARCHAR},
      </if>
      <if test="userNo != null">
        user_no = #{userNo,jdbcType=VARCHAR},
      </if>
      <if test="customerNo != null">
        customer_no = #{customerNo,jdbcType=VARCHAR},
      </if>
      <if test="externalCustomerNo != null">
        external_customer_no = #{externalCustomerNo,jdbcType=VARCHAR},
      </if>
      <if test="termNos != null">
        term_nos = #{termNos,jdbcType=VARCHAR},
      </if>
      <if test="agencyNo != null">
        agency_no = #{agencyNo,jdbcType=VARCHAR},
      </if>
      <if test="activeNo != null">
        active_no = #{activeNo,jdbcType=VARCHAR},
      </if>
      <if test="contractId != null">
        contract_id = #{contractId,jdbcType=VARCHAR},
      </if>
      <if test="coreTermIds != null">
        core_term_ids = #{coreTermIds,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantBackLkl">
    update tb_pluss_merchant_back_lkl
    set merchant_code = #{merchantCode,jdbcType=VARCHAR},
      merchant_id = #{merchantId,jdbcType=VARCHAR},
      channel = #{channel,jdbcType=VARCHAR},
      user_no = #{userNo,jdbcType=VARCHAR},
      customer_no = #{customerNo,jdbcType=VARCHAR},
      external_customer_no = #{externalCustomerNo,jdbcType=VARCHAR},
      term_nos = #{termNos,jdbcType=VARCHAR},
      agency_no = #{agencyNo,jdbcType=VARCHAR},
      active_no = #{activeNo,jdbcType=VARCHAR},
      contract_id = #{contractId,jdbcType=VARCHAR},
      core_term_ids = #{coreTermIds,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="selectByMercdeMerId" resultMap="BaseResultMap">

    select * from tb_pluss_merchant_back_lkl where merchant_code=#{merchantCode} and merchant_id=#{merchantId}
    </select>
</mapper>