<?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.tmerclub.cloud.multishop.mapper.ShopExtensionMapper">
  <resultMap id="shopExtensionMap" type="com.tmerclub.cloud.multishop.model.ShopExtension">
    <id column="shop_extension_id" property="shopExtensionId" />
    <result column="shop_id" property="shopId"/>
    <result column="create_time" property="createTime"/>
    <result column="update_time" property="updateTime"/>
    <result column="sale_num" property="saleNum"/>
    <result column="collection_num" property="collectionNum"/>
  </resultMap>
  <sql id="Vo_Column_List">
    `shop_extension_id`,`shop_id`,`create_time`,`update_time`,`sale_num`,`collection_num`
  </sql>
  <insert id="save">
    insert into shop_extension (`shop_id`)
    values (#{shopExtension.shopId});
  </insert>
  <update id="update">
    update shop_extension
    <set>
      <if test="shopExtension.saleNum != null">
        `sale_num` = #{shopExtension.saleNum},
      </if>
      <if test="shopExtension.collectionNum != null">
        `collection_num` = #{shopExtension.collectionNum},
      </if>
    </set>
    where shop_Id = #{shopExtension.shopId}
  </update>

  <select id="getByShopId" resultType="com.tmerclub.cloud.multishop.vo.ShopExtensionVO">
    select <include refid="Vo_Column_List"/>  from shop_extension where shop_id = #{shopId}
  </select>
</mapper>
