<?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.cecep.talroad.mapper.BasElecProCepMapMapper">
  <resultMap id="BaseResultMap" type="cn.cecep.talroad.domain.BasElecProCepMap">
    <!--@mbg.generated-->
    <!--@Table bas_elec_pro_cep_map-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="pro_device_id" jdbcType="VARCHAR" property="proDeviceId" />
    <result column="cep_device_id" jdbcType="VARCHAR" property="cepDeviceId" />
    <result column="is_status" jdbcType="SMALLINT" property="isStatus" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, pro_device_id, cep_device_id, is_status
  </sql>
  <insert id="insertSelective" parameterType="cn.cecep.talroad.domain.BasElecProCepMap">
    <!--@mbg.generated-->
    insert into bas_elec_pro_cep_map
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proDeviceId != null and proDeviceId != ''">
        pro_device_id,
      </if>
      <if test="cepDeviceId != null and cepDeviceId != ''">
        cep_device_id,
      </if>
      <if test="isStatus != null">
        is_status,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="proDeviceId != null and proDeviceId != ''">
        #{proDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="cepDeviceId != null and cepDeviceId != ''">
        #{cepDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="isStatus != null">
        #{isStatus,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.cecep.talroad.domain.BasElecProCepMap">
    <!--@mbg.generated-->
    update bas_elec_pro_cep_map
    <set>
      <if test="proDeviceId != null and proDeviceId != ''">
        pro_device_id = #{proDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="cepDeviceId != null and cepDeviceId != ''">
        cep_device_id = #{cepDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="isStatus != null">
        is_status = #{isStatus,jdbcType=SMALLINT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update bas_elec_pro_cep_map
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="pro_device_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=INTEGER} then #{item.proDeviceId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="cep_device_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=INTEGER} then #{item.cepDeviceId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="is_status = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=INTEGER} then #{item.isStatus,jdbcType=SMALLINT}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=INTEGER}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update bas_elec_pro_cep_map
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="pro_device_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.proDeviceId != null">
            when id = #{item.id,jdbcType=INTEGER} then #{item.proDeviceId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="cep_device_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.cepDeviceId != null">
            when id = #{item.id,jdbcType=INTEGER} then #{item.cepDeviceId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="is_status = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.isStatus != null">
            when id = #{item.id,jdbcType=INTEGER} then #{item.isStatus,jdbcType=SMALLINT}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=INTEGER}
    </foreach>
  </update>
  <insert id="batchInsert" parameterType="map">
    <!--@mbg.generated-->
    insert into bas_elec_pro_cep_map
    (id, pro_device_id, cep_device_id, is_status)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.id,jdbcType=INTEGER}, #{item.proDeviceId,jdbcType=VARCHAR}, #{item.cepDeviceId,jdbcType=VARCHAR}, 
        #{item.isStatus,jdbcType=SMALLINT})
    </foreach>
  </insert>
  <insert id="insertOrUpdate" parameterType="cn.cecep.talroad.domain.BasElecProCepMap">
    <!--@mbg.generated-->
    insert into bas_elec_pro_cep_map
    (id, pro_device_id, cep_device_id, is_status)
    values
    (#{id,jdbcType=INTEGER}, #{proDeviceId,jdbcType=VARCHAR}, #{cepDeviceId,jdbcType=VARCHAR}, 
      #{isStatus,jdbcType=SMALLINT})
    on duplicate key update 
    id = #{id,jdbcType=INTEGER}, 
    pro_device_id = #{proDeviceId,jdbcType=VARCHAR}, 
    cep_device_id = #{cepDeviceId,jdbcType=VARCHAR}, 
    is_status = #{isStatus,jdbcType=SMALLINT}
  </insert>
  <insert id="insertOrUpdateSelective" parameterType="cn.cecep.talroad.domain.BasElecProCepMap">
    <!--@mbg.generated-->
    insert into bas_elec_pro_cep_map
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proDeviceId != null and proDeviceId != ''">
        pro_device_id,
      </if>
      <if test="cepDeviceId != null and cepDeviceId != ''">
        cep_device_id,
      </if>
      <if test="isStatus != null">
        is_status,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="proDeviceId != null and proDeviceId != ''">
        #{proDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="cepDeviceId != null and cepDeviceId != ''">
        #{cepDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="isStatus != null">
        #{isStatus,jdbcType=SMALLINT},
      </if>
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="id != null">
        id = #{id,jdbcType=INTEGER},
      </if>
      <if test="proDeviceId != null and proDeviceId != ''">
        pro_device_id = #{proDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="cepDeviceId != null and cepDeviceId != ''">
        cep_device_id = #{cepDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="isStatus != null">
        is_status = #{isStatus,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
</mapper>