<?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.TbPlussMerchantImageMapper">
  <resultMap id="BaseResultMap" type="com.chaozhanggui.dao.system.entity.TbPlussMerchantImage">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="merchantCode" jdbcType="VARCHAR" property="merchantcode" />
    <result column="photoType" jdbcType="VARCHAR" property="phototype" />
    <result column="photoUrl" jdbcType="VARCHAR" property="photourl" />
    <result column="picUrl" jdbcType="VARCHAR" property="picurl" />
    <result column="createDt" jdbcType="TIMESTAMP" property="createdt" />
    <result column="updateDt" jdbcType="TIMESTAMP" property="updatedt" />
    <result column="aisleSwitch" jdbcType="VARCHAR" property="aisleswitch" />
  </resultMap>
  <sql id="Base_Column_List">
    id, merchantCode, photoType, photoUrl, picUrl, createDt, updateDt, aisleSwitch
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from tb_pluss_merchant_image
    where id = #{id,jdbcType=INTEGER}
  </select>
    <select id="selectByMerchantCode" resultType="com.chaozhanggui.dao.system.entity.TbPlussMerchantImage">
      select
      <include refid="Base_Column_List" />
      from tb_pluss_merchant_image
      where merchantCode = #{merchantCode}
      AND photoType IN (06, 08, 09, 101, 102)
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from tb_pluss_merchant_image
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantImage">
    insert into tb_pluss_merchant_image (id, merchantCode, photoType, 
      photoUrl, picUrl, createDt, 
      updateDt, aisleSwitch)
    values (#{id,jdbcType=INTEGER}, #{merchantcode,jdbcType=VARCHAR}, #{phototype,jdbcType=VARCHAR}, 
      #{photourl,jdbcType=VARCHAR}, #{picurl,jdbcType=VARCHAR}, #{createdt,jdbcType=TIMESTAMP}, 
      #{updatedt,jdbcType=TIMESTAMP}, #{aisleswitch,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantImage">
    insert into tb_pluss_merchant_image
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="merchantcode != null">
        merchantCode,
      </if>
      <if test="phototype != null">
        photoType,
      </if>
      <if test="photourl != null">
        photoUrl,
      </if>
      <if test="picurl != null">
        picUrl,
      </if>
      <if test="createdt != null">
        createDt,
      </if>
      <if test="updatedt != null">
        updateDt,
      </if>
      <if test="aisleswitch != null">
        aisleSwitch,
      </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="phototype != null">
        #{phototype,jdbcType=VARCHAR},
      </if>
      <if test="photourl != null">
        #{photourl,jdbcType=VARCHAR},
      </if>
      <if test="picurl != null">
        #{picurl,jdbcType=VARCHAR},
      </if>
      <if test="createdt != null">
        #{createdt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedt != null">
        #{updatedt,jdbcType=TIMESTAMP},
      </if>
      <if test="aisleswitch != null">
        #{aisleswitch,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantImage">
    update tb_pluss_merchant_image
    <set>
      <if test="merchantcode != null">
        merchantCode = #{merchantcode,jdbcType=VARCHAR},
      </if>
      <if test="phototype != null">
        photoType = #{phototype,jdbcType=VARCHAR},
      </if>
      <if test="photourl != null">
        photoUrl = #{photourl,jdbcType=VARCHAR},
      </if>
      <if test="picurl != null">
        picUrl = #{picurl,jdbcType=VARCHAR},
      </if>
      <if test="createdt != null">
        createDt = #{createdt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedt != null">
        updateDt = #{updatedt,jdbcType=TIMESTAMP},
      </if>
      <if test="aisleswitch != null">
        aisleSwitch = #{aisleswitch,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.chaozhanggui.dao.system.entity.TbPlussMerchantImage">
    update tb_pluss_merchant_image
    set merchantCode = #{merchantcode,jdbcType=VARCHAR},
      photoType = #{phototype,jdbcType=VARCHAR},
      photoUrl = #{photourl,jdbcType=VARCHAR},
      picUrl = #{picurl,jdbcType=VARCHAR},
      createDt = #{createdt,jdbcType=TIMESTAMP},
      updateDt = #{updatedt,jdbcType=TIMESTAMP},
      aisleSwitch = #{aisleswitch,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>