<?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.reptileclient.jlifeapp.dao.jz.HmRightsShopOriginMapper">
  <resultMap id="BaseResultMap" type="com.reptileclient.jlifeapp.entity.jz.HmRightsShopOrigin">
    <!--@mbg.generated-->
    <!--@Table hm_rights_shop_origin-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="shop_code" jdbcType="VARCHAR" property="shopCode" />
    <result column="shop_name" jdbcType="VARCHAR" property="shopName" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, shop_code, shop_name, create_time, update_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from hm_rights_shop_origin
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from hm_rights_shop_origin
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.reptileclient.jlifeapp.entity.jz.HmRightsShopOrigin" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into hm_rights_shop_origin (shop_code, shop_name, create_time,
      update_time)
    values (#{shopCode,jdbcType=VARCHAR}, #{shopName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
      #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.reptileclient.jlifeapp.entity.jz.HmRightsShopOrigin" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into hm_rights_shop_origin
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="shopCode != null and shopCode != ''">
        shop_code,
      </if>
      <if test="shopName != null and shopName != ''">
        shop_name,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="shopCode != null and shopCode != ''">
        #{shopCode,jdbcType=VARCHAR},
      </if>
      <if test="shopName != null and shopName != ''">
        #{shopName,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.reptileclient.jlifeapp.entity.jz.HmRightsShopOrigin">
    <!--@mbg.generated-->
    update hm_rights_shop_origin
    <set>
      <if test="shopCode != null and shopCode != ''">
        shop_code = #{shopCode,jdbcType=VARCHAR},
      </if>
      <if test="shopName != null and shopName != ''">
        shop_name = #{shopName,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=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.reptileclient.jlifeapp.entity.jz.HmRightsShopOrigin">
    <!--@mbg.generated-->
    update hm_rights_shop_origin
    set shop_code = #{shopCode,jdbcType=VARCHAR},
      shop_name = #{shopName,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update hm_rights_shop_origin
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="shop_code = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.shopCode,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="shop_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.shopName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="create_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="update_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update hm_rights_shop_origin
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="shop_code = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.shopCode != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.shopCode,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="shop_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.shopName != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.shopName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="create_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.createTime != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.createTime,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="update_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.updateTime != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.updateTime,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into hm_rights_shop_origin
    (shop_code, shop_name, create_time, update_time)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.shopCode,jdbcType=VARCHAR}, #{item.shopName,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
        #{item.updateTime,jdbcType=TIMESTAMP})
    </foreach>
  </insert>
  <insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.reptileclient.jlifeapp.entity.jz.HmRightsShopOrigin" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into hm_rights_shop_origin
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      shop_code,
      shop_name,
      create_time,
      update_time,
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      #{shopCode,jdbcType=VARCHAR},
      #{shopName,jdbcType=VARCHAR},
      #{createTime,jdbcType=TIMESTAMP},
      #{updateTime,jdbcType=TIMESTAMP},
    </trim>
    on duplicate key update
    <trim suffixOverrides=",">
      <if test="id != null">
        id = #{id,jdbcType=BIGINT},
      </if>
      shop_code = #{shopCode,jdbcType=VARCHAR},
      shop_name = #{shopName,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
    </trim>
  </insert>
  <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.reptileclient.jlifeapp.entity.jz.HmRightsShopOrigin" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into hm_rights_shop_origin
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="shopCode != null and shopCode != ''">
        shop_code,
      </if>
      <if test="shopName != null and shopName != ''">
        shop_name,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="shopCode != null and shopCode != ''">
        #{shopCode,jdbcType=VARCHAR},
      </if>
      <if test="shopName != null and shopName != ''">
        #{shopName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
    on duplicate key update
    <trim suffixOverrides=",">
      <if test="id != null">
        id = #{id,jdbcType=BIGINT},
      </if>
      <if test="shopCode != null and shopCode != ''">
        shop_code = #{shopCode,jdbcType=VARCHAR},
      </if>
      <if test="shopName != null and shopName != ''">
        shop_name = #{shopName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>

  <delete id="cleanALl">
    delete from hm_rights_shop_origin
    </delete>
</mapper>
