<?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.MallStoreGoodsGalleryMapper" >
  <resultMap id="BaseResultMap" type="com.kmall.api.entity.MallStoreGoodsGallery" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="goods_id" property="goodsId" jdbcType="INTEGER" />
    <result column="product_store_id" property="productStoreId" jdbcType="INTEGER" />
    <result column="img_desc" property="imgDesc" jdbcType="VARCHAR" />
    <result column="sort_order" property="sortOrder" jdbcType="INTEGER" />
    <result column="img_url" property="imgUrl" jdbcType="VARCHAR" />
    <result column="goods_biz_type" property="goodsBizType" jdbcType="CHAR" />
    <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, goods_id, product_store_id, img_desc, sort_order, img_url, goods_biz_type, 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_goods_gallery
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="delete" parameterType="java.lang.Integer" >
    delete from mall_store_goods_gallery
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="save" parameterType="com.kmall.api.entity.MallStoreGoodsGallery"  useGeneratedKeys="true" keyProperty="id">
    insert into mall_store_goods_gallery
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="goodsId != null" >
        goods_id,
      </if>
      <if test="productStoreId != null" >
        product_store_id,
      </if>
      <if test="imgDesc != null" >
        img_desc,
      </if>
      <if test="sortOrder != null" >
        sort_order,
      </if>
      <if test="imgUrl != null" >
        img_url,
      </if>
      <if test="goodsBizType != null" >
        goods_biz_type,
      </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="goodsId != null" >
        #{goodsId,jdbcType=INTEGER},
      </if>
      <if test="productStoreId != null" >
        #{productStoreId,jdbcType=INTEGER},
      </if>
      <if test="imgDesc != null" >
        #{imgDesc,jdbcType=VARCHAR},
      </if>
      <if test="sortOrder != null" >
        #{sortOrder,jdbcType=INTEGER},
      </if>
      <if test="imgUrl != null" >
        #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="goodsBizType != null" >
        #{goodsBizType,jdbcType=CHAR},
      </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.MallStoreGoodsGallery" >
    update mall_store_goods_gallery
    <set >
      <if test="goodsId != null" >
        goods_id = #{goodsId,jdbcType=INTEGER},
      </if>
      <if test="productStoreId != null" >
        product_store_id = #{productStoreId,jdbcType=INTEGER},
      </if>
      <if test="imgDesc != null" >
        img_desc = #{imgDesc,jdbcType=VARCHAR},
      </if>
      <if test="sortOrder != null" >
        sort_order = #{sortOrder,jdbcType=INTEGER},
      </if>
      <if test="imgUrl != null" >
        img_url = #{imgUrl,jdbcType=VARCHAR},
      </if>
      <if test="goodsBizType != null" >
        goods_biz_type = #{goodsBizType,jdbcType=CHAR},
      </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>