<?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.kmall.api.dao.ApiStoreMngChangeMapper" >
  <resultMap id="BaseResultMap" type="com.kmall.api.entity.MallStoreMngChange" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="store_change_num" property="storeChangeNum" jdbcType="INTEGER" />
    <result column="store_original_num" property="storeOriginalNum" jdbcType="INTEGER" />
    <result column="store_valid_num" property="storeValidNum" jdbcType="INTEGER" />
    <result column="merch_sn" property="merchSn" jdbcType="VARCHAR" />
    <result column="store_id" property="storeId" jdbcType="INTEGER" />
    <result column="sku" property="sku" jdbcType="VARCHAR" />
    <result column="is_valid" property="isValid" jdbcType="INTEGER" />
    <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="moder_sn" property="moderSn" jdbcType="VARCHAR" />
    <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
    <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, store_change_num, store_original_num, store_valid_num, merch_sn, store_id, sku, 
    is_valid, creater_sn, create_time, moder_sn, mod_time, tstm
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from mall_store_mng_change
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="delete" parameterType="java.lang.Integer" >
    delete from mall_store_mng_change
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="save" parameterType="com.kmall.api.entity.MallStoreMngChange"  useGeneratedKeys="true" keyProperty="id">
    insert into mall_store_mng_change
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="storeChangeNum != null" >
        store_change_num,
      </if>
      <if test="storeOriginalNum != null" >
        store_original_num,
      </if>
      <if test="storeValidNum != null" >
        store_valid_num,
      </if>
      <if test="merchSn != null" >
        merch_sn,
      </if>
      <if test="storeId != null" >
        store_id,
      </if>
      <if test="sku != null" >
        sku,
      </if>
      <if test="isValid != null" >
        is_valid,
      </if>
      <if test="createrSn != null" >
        creater_sn,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="moderSn != null" >
        moder_sn,
      </if>
      <if test="modTime != null" >
        mod_time,
      </if>
      <if test="tstm != null" >
        tstm,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="storeChangeNum != null" >
        #{storeChangeNum,jdbcType=INTEGER},
      </if>
      <if test="storeOriginalNum != null" >
        #{storeOriginalNum,jdbcType=INTEGER},
      </if>
      <if test="storeValidNum != null" >
        #{storeValidNum,jdbcType=INTEGER},
      </if>
      <if test="merchSn != null" >
        #{merchSn,jdbcType=VARCHAR},
      </if>
      <if test="storeId != null" >
        #{storeId,jdbcType=INTEGER},
      </if>
      <if test="sku != null" >
        #{sku,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null" >
        #{isValid,jdbcType=INTEGER},
      </if>
      <if test="createrSn != null" >
        #{createrSn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="moderSn != null" >
        #{moderSn,jdbcType=VARCHAR},
      </if>
      <if test="modTime != null" >
        #{modTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tstm != null" >
        #{tstm,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>

  <update id="update" parameterType="com.kmall.api.entity.MallStoreMngChange" >
    update mall_store_mng_change
    <set >
      <if test="storeChangeNum != null" >
        store_change_num = #{storeChangeNum,jdbcType=INTEGER},
      </if>
      <if test="storeOriginalNum != null" >
        store_original_num = #{storeOriginalNum,jdbcType=INTEGER},
      </if>
      <if test="storeValidNum != null" >
        store_valid_num = #{storeValidNum,jdbcType=INTEGER},
      </if>
      <if test="merchSn != null" >
        merch_sn = #{merchSn,jdbcType=VARCHAR},
      </if>
      <if test="storeId != null" >
        store_id = #{storeId,jdbcType=INTEGER},
      </if>
      <if test="sku != null" >
        sku = #{sku,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null" >
        is_valid = #{isValid,jdbcType=INTEGER},
      </if>
      <if test="createrSn != null" >
        creater_sn = #{createrSn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="moderSn != null" >
        moder_sn = #{moderSn,jdbcType=VARCHAR},
      </if>
      <if test="modTime != null" >
        mod_time = #{modTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tstm != null" >
        tstm = #{tstm,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>