<?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.TbPlussMerchantChannelMapper">
  <resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannel">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="channelName" jdbcType="VARCHAR" property="channelname" />
    <result column="channelCode" jdbcType="VARCHAR" property="channelcode" />
    <result column="status" jdbcType="VARCHAR" property="status" />
    <result column="wxCertImg" jdbcType="VARCHAR" property="wxcertimg" />
  </resultMap>
  <sql id="Base_Column_List">
    id, channelName, channelCode, status, wxCertImg
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from tb_pluss_merchant_channel
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from tb_pluss_merchant_channel
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannel">
    insert into tb_pluss_merchant_channel (id, channelName, channelCode, 
      status, wxCertImg)
    values (#{id,jdbcType=INTEGER}, #{channelname,jdbcType=VARCHAR}, #{channelcode,jdbcType=VARCHAR}, 
      #{status,jdbcType=VARCHAR}, #{wxcertimg,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannel">
    insert into tb_pluss_merchant_channel
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="channelname != null">
        channelName,
      </if>
      <if test="channelcode != null">
        channelCode,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="wxcertimg != null">
        wxCertImg,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="channelname != null">
        #{channelname,jdbcType=VARCHAR},
      </if>
      <if test="channelcode != null">
        #{channelcode,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=VARCHAR},
      </if>
      <if test="wxcertimg != null">
        #{wxcertimg,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannel">
    update tb_pluss_merchant_channel
    <set>
      <if test="channelname != null">
        channelName = #{channelname,jdbcType=VARCHAR},
      </if>
      <if test="channelcode != null">
        channelCode = #{channelcode,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=VARCHAR},
      </if>
      <if test="wxcertimg != null">
        wxCertImg = #{wxcertimg,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantChannel">
    update tb_pluss_merchant_channel
    set channelName = #{channelname,jdbcType=VARCHAR},
      channelCode = #{channelcode,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      wxCertImg = #{wxcertimg,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <select id="selectAll" resultMap="BaseResultMap">
    select * from tb_pluss_merchant_channel where `status`=1
    </select>
</mapper>